So here's my suggestion regarding the date & time formats used in the listings.
I started by adding two new configuration items.
File: application/config/grocery_crud.php
$config['grocery_crud_default_date_format'] = 'd M Y';
$config['grocery_crud_default_datetime_format'] = 'd M Y - H:i';
Then we just need to use those formats in the grocery CRUD library file.
File: application/libraries/grocery_crud.php (around line #233)
case 'date':
if(!empty($value) && $value != '0000-00-00')
{
$ci = &get_instance();
$format = $ci->config->item('grocery_crud_default_date_format');
list($year,$month,$day) = explode("-",$value);
$value = date ($format, mktime (0,0,0,(int)$month , (int)$day , (int)$year));
}
else
{
$value = '';
}
break;
case 'datetime':
if(!empty($value) && $value != '0000-00-00 00:00:00' && $value != '1970-01-01 00:00:00')
{
$ci = &get_instance();
$format = $ci->config->item('grocery_crud_default_datetime_format');
list($year,$month,$day) = explode("-",$value);
list($hours,$minutes) = explode(":",substr($value,11));
$value = date ($format, mktime ( (int)$hours , (int)$minutes ,0, (int)$month , (int)$day ,(int)$year));
}
else
{
$value = '';
}
break;
And that's it. Now users can customize date / datetime formats.
What do you think about it, Johnny?
-Rafael