diff --git a/modules/oe_theme_content_event/config/install/core.date_format.oe_event_programme_date_with_hour_with_timezone.yml b/modules/oe_theme_content_event/config/install/core.date_format.oe_event_programme_date_hour_timezone.yml similarity index 72% rename from modules/oe_theme_content_event/config/install/core.date_format.oe_event_programme_date_with_hour_with_timezone.yml rename to modules/oe_theme_content_event/config/install/core.date_format.oe_event_programme_date_hour_timezone.yml index 864efce35..0f924baf1 100644 --- a/modules/oe_theme_content_event/config/install/core.date_format.oe_event_programme_date_with_hour_with_timezone.yml +++ b/modules/oe_theme_content_event/config/install/core.date_format.oe_event_programme_date_hour_timezone.yml @@ -1,7 +1,7 @@ langcode: en status: true dependencies: { } -id: oe_event_programme_date_with_hour_with_timezone +id: oe_event_programme_date_hour_timezone label: 'Event programme date with hour with timezone' locked: false pattern: 'j M Y, h:i A T' diff --git a/modules/oe_theme_content_event/config/post_updates/30002_event_programme_date_format/core.date_format.oe_event_programme_hour_timezone.yml b/modules/oe_theme_content_event/config/post_updates/30002_event_programme_date_format/core.date_format.oe_event_programme_hour_timezone.yml new file mode 100644 index 000000000..3e7247c1d --- /dev/null +++ b/modules/oe_theme_content_event/config/post_updates/30002_event_programme_date_format/core.date_format.oe_event_programme_hour_timezone.yml @@ -0,0 +1,7 @@ +langcode: en +status: true +dependencies: { } +id: oe_event_programme_hour_timezone +label: 'Event programme hour with timezone' +locked: false +pattern: 'h:i A T' diff --git a/modules/oe_theme_content_event/oe_theme_content_event.post_update.php b/modules/oe_theme_content_event/oe_theme_content_event.post_update.php index bb6140485..99952f385 100644 --- a/modules/oe_theme_content_event/oe_theme_content_event.post_update.php +++ b/modules/oe_theme_content_event/oe_theme_content_event.post_update.php @@ -123,3 +123,19 @@ function oe_theme_content_event_post_update_30001() { $date_format->save(); } } + +/** + * Update Event programme date formats. + */ +function oe_theme_content_event_post_update_30002(): void { + // Remove "Event programme date with timezone" as it's not used anymore. + $date_timezone = DateFormat::load('oe_event_programme_date_timezone'); + $date_timezone->delete(); + + // Create new time format with timezone. + $storage = new FileStorage(drupal_get_path('module', 'oe_theme_content_event') . '/config/post_updates/30002_event_programme_date_format'); + $config = $storage->read('core.date_format.oe_event_programme_hour_timezone'); + $config['_core']['default_config_hash'] = Crypt::hashBase64(serialize($config)); + $date_format = DateFormat::create($config); + $date_format->save(); +} diff --git a/modules/oe_theme_content_event/src/Plugin/ExtraField/Display/ProgrammeExtraField.php b/modules/oe_theme_content_event/src/Plugin/ExtraField/Display/ProgrammeExtraField.php index 9ce4b7394..e9aaf4478 100755 --- a/modules/oe_theme_content_event/src/Plugin/ExtraField/Display/ProgrammeExtraField.php +++ b/modules/oe_theme_content_event/src/Plugin/ExtraField/Display/ProgrammeExtraField.php @@ -37,7 +37,7 @@ class ProgrammeExtraField extends EventExtraFieldBase { /** * Programme datetime with timezone format. */ - const PROGRAMME_DATETIME_TIMEZONE_FORMAT = 'oe_event_programme_date_with_hour_with_timezone'; + const PROGRAMME_DATETIME_TIMEZONE_FORMAT = 'oe_event_programme_date_hour_timezone'; /** * Programme date format.