Jump to content


The date format used in Europe and elsewhere

date label date format insert label

  • Please log in to reply
4 replies to this topic

#1 pvalen

pvalen

    Member

  • Members
  • PipPip
  • 15 posts

Posted 31 May 2013 - 12:02 PM

Please add the new version to a file grocery_crud.php to function _load_date_format()

 

case 'eu-date':
    $this->php_date_format = "$php_day.$php_month.$php_year";
    $this->js_date_format  = "$js_day.$js_month.$js_year";
    $this->ui_date_format  = "$ui_day.$ui_month.$ui_year";
break;

 

the data format (1.1.2013 13:25) used in Europe and elsewhere.

 

Please also addition function to enter text information to the item on the form. Using callback_ is not applicable for example to insert file, date etc..

callback_edit_field
http://www.grocerycr...t_field_example
callback_add_field
http://www.grocerycr...d_field_example



#2 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 01 June 2013 - 07:21 AM

Under application/config there is this line,

 

// There are only three choices: "uk-date" (dd/mm/yyyy), "us-date" (mm/dd/yyyy) or "sql-date" (yyyy-mm-dd) 
$config['grocery_crud_date_format'] = 'uk-date';

How the proposed 'eu date' you ask to add is different from this 'uk_date'?

 

Now for the callbacks for add and edit. Because of the special nature of the callback functions in PHP what you ask is not possible.

Read here for your information.


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#3 pvalen

pvalen

    Member

  • Members
  • PipPip
  • 15 posts

Posted 06 June 2013 - 08:43 AM

The date format is in Central Europe (dd.mm.yyyy) other than in England (dd/mm/yyyy)

 

I want you to do directly in the function _load_date_format() add this code. So then the function looks like:

 

protected function _load_date_format()
 {
  list($php_day, $php_month, $php_year) = array('d','m','Y');
  list($js_day, $js_month, $js_year) = array('dd','mm','yy');
  list($ui_day, $ui_month, $ui_year) = array('dd','mm','yyyy');
//@todo ui_day, ui_month, ui_year has to be lang strings
  
  $date_format = $this->config->date_format;
  switch ($date_format) {
   case 'uk-date':
    $this->php_date_format   = "$php_day/$php_month/$php_year";
    $this->js_date_format  = "$js_day/$js_month/$js_year";
    $this->ui_date_format  = "$ui_day/$ui_month/$ui_year";
   break;
   
   case 'us-date':
    $this->php_date_format   = "$php_month/$php_day/$php_year";
    $this->js_date_format  = "$js_month/$js_day/$js_year";
    $this->ui_date_format  = "$ui_month/$ui_day/$ui_year";
   break;
   
   case 'eu-date':
    $this->php_date_format   = "$php_day.$php_month.$php_year";
    $this->js_date_format  = "$js_day.$js_month.$js_year";
    $this->ui_date_format  = "$ui_day.$ui_month.$ui_year";
   break;
   
   case 'sql-date':
   default:
    $this->php_date_format   = "$php_year-$php_month-$php_day";
    $this->js_date_format  = "$js_year-$js_month-$js_day";
    $this->ui_date_format  = "$ui_year-$ui_month-$ui_day";
   break;
  }
 }

 

I have added it myself and it works.



#4 pvalen

pvalen

    Member

  • Members
  • PipPip
  • 15 posts

Posted 06 June 2013 - 09:19 AM

I do not want to do it with the callbacks. I would like you to do a new function, so I could add some text before or after <input ...> etc.

 

Using the callbacks is difficult and can not be used for inserting the date, file, etc.



#5 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 06 June 2013 - 01:12 PM

Oh! Ok!

And I want you to post an issue here!

You welcome!


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr






Also tagged with one or more of these keywords: date, label, date format, insert label

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users