diff --git a/core/includes/common.inc b/core/includes/common.inc index 89a6c77..fe09862 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -1943,30 +1943,29 @@ function format_date($timestamp, $type = 'system_medium', $format = '', $timezon if (empty($langcode)) { $langcode = language(LANGUAGE_TYPE_INTERFACE)->langcode; } - $settings = array('langcode' => $langcode); // Create a DrupalDateTime object from the timestamp and timezone. - $date_time = new DrupalDateTime($timestamp, $timezones[$timezone]); + $date = new DrupalDateTime($timestamp, $timezones[$timezone]); // Find the appropriate format type. - $key = $date_time->canUseIntl() ? DrupalDateTime::INTL : DrupalDateTime::PHP; + $key = $date->canUseIntl() ? DrupalDateTime::INTL : DrupalDateTime::PHP; // if we have a non-custom date format use the provided date format pattern. if ($type != 'custom') { $format = config('system.date')->get('formats.' . $type . '.pattern.' . $key); } - // Fall back to system_medium if a value was not found. + // Fall back to system_medium if a format was not found. if (empty($format)) { $format = config('system.date')->get('formats.system_medium.pattern.' . $key); } - if ($key == DrupalDateTime::INTL) { - $settings['format_string_type'] = $key; - } - - // Call date_format(). - return $date_time->format($format, $settings); + // Call $date->format(). + $settings = array( + 'langcode' => $langcode, + 'format_string_type' => $key, + ); + return $date->format($format, $settings); } /** diff --git a/core/modules/system/config/system.date.yml b/core/modules/system/config/system.date.yml index c2dfc78..a1b1120 100644 --- a/core/modules/system/config/system.date.yml +++ b/core/modules/system/config/system.date.yml @@ -30,7 +30,7 @@ formats: name: 'HTML Datetime' pattern: php: 'Y-m-d\TH:i:sO' - intl: 'yyyy-MM-dd'Tkk:mm:ssZZ' + intl: "yyyy-MM-dd'Tkk:mm:ssZZ" locked: 1 html_date: name: 'HTML Date' @@ -54,7 +54,7 @@ formats: name: 'HTML Week' pattern: php: 'Y-\WW' - intl: 'Y-'WW' + intl: "Y-'WW" locked: 1 html_month: name: 'HTML Month' diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 1f79f24..616528f 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -2868,8 +2868,8 @@ function system_date_format_localize_form($form, &$form_state, $langcode) { */ function system_date_time_lookup($form, &$form_state) { $format = ''; - if (!empty($form_state['values']['date_format'])) { - $format = t('Displayed as %date_format', array('%date_format' => format_date(REQUEST_TIME, 'custom', $form_state['values']['date_format']))); + if (!empty($form_state['values']['date_format_pattern'])) { + $format = t('Displayed as %date_format', array('%date_format' => format_date(REQUEST_TIME, 'custom', $form_state['values']['date_format_pattern']))); } // Return a command instead of a string, since the Ajax framework // automatically prepends an additional empty DIV element for a string, which