⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Change date format dynamically for each client based on clients configuration



marlaaragao
  • profile picture
  • Member

Posted 23 October 2015 - 15:58 PM

Hello,

 

This may sound dumb, but I wonder if there's a way to change the date format based on users configuration. I tried doing this on the callback_after_update of the configuration model:

$ci = &get_instance();
$ci->config->set_item('grocery_crud_date_format', $post_array['date_format'] == 'Y-m-d' ? 'sql-date' : 
                    ($post_array['date_format'] == 'd/m/Y' ? 'uk-date' : 'us-date'));

But it does no work. The date_format is always the one from the config file.

I know I can do a callback for each date field in my program, but I want to know if there's a simpler way to acomplish this. Any ideas? Thanks very much!