When a custom date format is defined with hook_date_fomats() and hook_date_format_types(), the information is saved to the date_formats and date_format_types. However, the corresponding system variables are not written to the variables table, so that when content_format is called, the date is not formatted with the desired format. The only time these variables are saved is when the form is submitted at admin/settings/date-time/formats. So in other words, if I want my custom formats that I've defined in my hooks to actually work, I have to go to admin/settings/date-time/formats and save the form.
I've looked through the code in date_api, and date_api_date_formats_form() is only place where date format variables are written to the variables table. Is there another way I'm missing to update the variables table?
Thanks,
Comments
Comment #1
JayKandariCan still reproduce this issue in 7.x-2.10 version.
I followed following steps in vanilla drupal with date module & date API enabled.
* Added field to a content type
* goto manage display
* Change date field format to custom,
* provide a custom date format eg: "d-m-y"
* click update & save content type.
* reopen date field format settings. Custom format field is empty.
Bonus, When you view a content with this settings. following warning is issued & date field isn't shown.
Comment #2
DamienMcKenna