The function system_get_date_formats()
has a changed return value in Backdrop compared with Drupal 7. Previously, the return value for each date format contained an array of formats for each locale. Since Backdrop 1.0.0, the date formats have been simplified into a less-nested array. Instead of each format having multiple arrays for each different format string, Backdrop has only a single array for each format with a list of strings (and their associate locales) within the the "locales" key.
For example if you had configured the default short date format to be the more common format of Y-m-d H:i
but (using Locale module) specified the U.S. date format to be 'm/d/Y - H:i'
, the return value of system_get_date_formats()
would look like this:
Drupal 7:
array (
'short' => array (
'Y-m-d H:i' => array (
'type' => 'short',
'format' => 'Y-m-d H:i',
'locales' => array (),
'locked' => '1',
'is_new' => false,
'dfid' => '1',
'language' => NULL,
),
'm/d/Y - H:i' => array (
'type' => 'short',
'format' => 'm/d/Y - H:i',
'locales' => array (
0 => 'en-us',
),
'locked' => '1',
'is_new' => false,
'dfid' => '2',
'language' => NULL,
),
...
Backdrop:
array (
'short' => array (
'label' => 'Short Date',
'pattern' => 'Y-m-d H:i',
'module' => 'system',
'name' => 'short',
'locales' => array(
'en-us' => 'm/d/Y - H:i',
),
),
...