diff --git a/composer.json b/composer.json index 1ce48248e48bb2fa5f29ad63d7c232fed67199b6..95db85588fa745e5267ec85742f25577009d4cbd 100644 --- a/composer.json +++ b/composer.json @@ -9,6 +9,7 @@ "php": ">=7.4", "cweagans/composer-patches": "^1.7", "drupal/core": "^9.2", + "drupal/daterange_compact": "^2.0", "drupal/twig_field_value": "^2.0", "openeuropa/composer-artifacts": "^1.0.0-alpha1", "openeuropa/oe_bootstrap_theme": "0.1.202206231430" diff --git a/modules/oe_whitelabel_helper/config/install/daterange_compact.format.oe_whitelabel_date_only_short_month.yml b/modules/oe_whitelabel_helper/config/install/daterange_compact.format.oe_whitelabel_date_only_short_month.yml new file mode 100644 index 0000000000000000000000000000000000000000..73b6820a302413a655e2b20ab805d1cfef6d7b41 --- /dev/null +++ b/modules/oe_whitelabel_helper/config/install/daterange_compact.format.oe_whitelabel_date_only_short_month.yml @@ -0,0 +1,16 @@ +langcode: en +status: true +dependencies: { } +id: oe_whitelabel_date_only_short_month +label: 'Date only, short month' +default_pattern: 'd M Y' +default_separator: ' - ' +same_day_start_pattern: 'd M Y' +same_day_end_pattern: '' +same_day_separator: '' +same_month_start_pattern: '' +same_month_end_pattern: '' +same_month_separator: '' +same_year_start_pattern: '' +same_year_end_pattern: '' +same_year_separator: '' diff --git a/modules/oe_whitelabel_helper/config/install/daterange_compact.format.oe_whitelabel_date_time_long.yml b/modules/oe_whitelabel_helper/config/install/daterange_compact.format.oe_whitelabel_date_time_long.yml new file mode 100644 index 0000000000000000000000000000000000000000..9756862ed8dd8db606c2f4dd472f139fb5fa73ab --- /dev/null +++ b/modules/oe_whitelabel_helper/config/install/daterange_compact.format.oe_whitelabel_date_time_long.yml @@ -0,0 +1,16 @@ +langcode: en +status: true +dependencies: { } +id: oe_whitelabel_date_time_long +label: 'Date and time, long names' +default_pattern: 'l d F Y, H.i (T)' +default_separator: ' - ' +same_day_start_pattern: 'l d F Y, H.i' +same_day_end_pattern: 'H.i (T)' +same_day_separator: '-' +same_month_start_pattern: '' +same_month_end_pattern: '' +same_month_separator: '' +same_year_start_pattern: '' +same_year_end_pattern: '' +same_year_separator: '' diff --git a/modules/oe_whitelabel_helper/oe_whitelabel_helper.info.yml b/modules/oe_whitelabel_helper/oe_whitelabel_helper.info.yml index 210d21be2ad7fb4cdc8704053c6291c557a5acea..28581dbdfae273a2daf4903b8c8e4be0594ca6ae 100644 --- a/modules/oe_whitelabel_helper/oe_whitelabel_helper.info.yml +++ b/modules/oe_whitelabel_helper/oe_whitelabel_helper.info.yml @@ -7,6 +7,7 @@ core_version_requirement: ^9.2 dependencies: - drupal:node - drupal:twig_field_value + - drupal:daterange_compact - oe_bootstrap_theme:oe_bootstrap_theme_helper - openeuropa:oe_corporate_blocks @@ -15,3 +16,5 @@ dependencies: config_devel: install: - core.entity_view_mode.node.oe_w_content_banner + - daterange_compact.format.oe_whitelabel_date_only_short_month + - daterange_compact.format.oe_whitelabel_date_time_long diff --git a/modules/oe_whitelabel_starter_event/config/install/core.entity_view_display.node.oe_sc_event.full.yml b/modules/oe_whitelabel_starter_event/config/install/core.entity_view_display.node.oe_sc_event.full.yml index 5828f84947d99440c3ec9317f3e96490478f0364..ebe638c0dfdb14b307dbf6e6cac01a8ffdf76560 100755 --- a/modules/oe_whitelabel_starter_event/config/install/core.entity_view_display.node.oe_sc_event.full.yml +++ b/modules/oe_whitelabel_starter_event/config/install/core.entity_view_display.node.oe_sc_event.full.yml @@ -11,8 +11,8 @@ dependencies: - field.field.node.oe_sc_event.oe_summary - node.type.oe_sc_event module: + - daterange_compact - oe_whitelabel_helper - - oe_whitelabel_starter_event - text - user id: node.oe_sc_event.full @@ -42,9 +42,10 @@ content: weight: 3 region: content oe_sc_event_dates: - type: event_date_range_format + type: daterange_compact label: inline - settings: { } + settings: + daterange_compact_format: oe_whitelabel_date_time_long third_party_settings: { } weight: 1 region: content diff --git a/modules/oe_whitelabel_starter_event/config/install/core.entity_view_display.node.oe_sc_event.teaser.yml b/modules/oe_whitelabel_starter_event/config/install/core.entity_view_display.node.oe_sc_event.teaser.yml index b540c64a3c1fee241267a3366eea6565552b9a02..22910d1f2e64e793e4845856abd0c41de9dd3a82 100755 --- a/modules/oe_whitelabel_starter_event/config/install/core.entity_view_display.node.oe_sc_event.teaser.yml +++ b/modules/oe_whitelabel_starter_event/config/install/core.entity_view_display.node.oe_sc_event.teaser.yml @@ -12,7 +12,7 @@ dependencies: - node.type.oe_sc_event module: - address - - oe_whitelabel_starter_event + - daterange_compact - text - user id: node.oe_sc_event.teaser @@ -21,11 +21,10 @@ bundle: oe_sc_event mode: teaser content: oe_sc_event_dates: - type: event_date_range_format + type: daterange_compact label: hidden settings: - time_format: '' - datetime_format: 'd M Y' + daterange_compact_format: oe_whitelabel_date_only_short_month third_party_settings: { } weight: 4 region: content diff --git a/modules/oe_whitelabel_starter_event/config/post_updates/00002_event_date_show_time/core.date_format.oe_whitelabel_project_date.yml b/modules/oe_whitelabel_starter_event/config/post_updates/00002_event_date_show_time/core.date_format.oe_whitelabel_project_date.yml deleted file mode 100644 index cd2d1aee7f7f59f3eab2fb8a87e502ef2dd91eed..0000000000000000000000000000000000000000 --- a/modules/oe_whitelabel_starter_event/config/post_updates/00002_event_date_show_time/core.date_format.oe_whitelabel_project_date.yml +++ /dev/null @@ -1,7 +0,0 @@ -langcode: en -status: true -dependencies: { } -id: oe_whitelabel_project_date -label: 'OE Whitelabel Project date' -locked: false -pattern: 'd M Y' diff --git a/modules/oe_whitelabel_starter_event/config/post_updates/00002_event_date_show_time/core.entity_view_display.node.oe_sc_event.full.yml b/modules/oe_whitelabel_starter_event/config/post_updates/00002_event_date_show_time/core.entity_view_display.node.oe_sc_event.full.yml index 5828f84947d99440c3ec9317f3e96490478f0364..ebe638c0dfdb14b307dbf6e6cac01a8ffdf76560 100755 --- a/modules/oe_whitelabel_starter_event/config/post_updates/00002_event_date_show_time/core.entity_view_display.node.oe_sc_event.full.yml +++ b/modules/oe_whitelabel_starter_event/config/post_updates/00002_event_date_show_time/core.entity_view_display.node.oe_sc_event.full.yml @@ -11,8 +11,8 @@ dependencies: - field.field.node.oe_sc_event.oe_summary - node.type.oe_sc_event module: + - daterange_compact - oe_whitelabel_helper - - oe_whitelabel_starter_event - text - user id: node.oe_sc_event.full @@ -42,9 +42,10 @@ content: weight: 3 region: content oe_sc_event_dates: - type: event_date_range_format + type: daterange_compact label: inline - settings: { } + settings: + daterange_compact_format: oe_whitelabel_date_time_long third_party_settings: { } weight: 1 region: content diff --git a/modules/oe_whitelabel_starter_event/config/post_updates/00002_event_date_show_time/core.entity_view_display.node.oe_sc_event.teaser.yml b/modules/oe_whitelabel_starter_event/config/post_updates/00002_event_date_show_time/core.entity_view_display.node.oe_sc_event.teaser.yml index b540c64a3c1fee241267a3366eea6565552b9a02..22910d1f2e64e793e4845856abd0c41de9dd3a82 100755 --- a/modules/oe_whitelabel_starter_event/config/post_updates/00002_event_date_show_time/core.entity_view_display.node.oe_sc_event.teaser.yml +++ b/modules/oe_whitelabel_starter_event/config/post_updates/00002_event_date_show_time/core.entity_view_display.node.oe_sc_event.teaser.yml @@ -12,7 +12,7 @@ dependencies: - node.type.oe_sc_event module: - address - - oe_whitelabel_starter_event + - daterange_compact - text - user id: node.oe_sc_event.teaser @@ -21,11 +21,10 @@ bundle: oe_sc_event mode: teaser content: oe_sc_event_dates: - type: event_date_range_format + type: daterange_compact label: hidden settings: - time_format: '' - datetime_format: 'd M Y' + daterange_compact_format: oe_whitelabel_date_only_short_month third_party_settings: { } weight: 4 region: content diff --git a/modules/oe_whitelabel_starter_event/oe_whitelabel_starter_event.post_update.php b/modules/oe_whitelabel_starter_event/oe_whitelabel_starter_event.post_update.php index 104cbf393fa48b5ddaab0fcccf642cfa0d442ca5..817165f1399380bd5b08ab557d513dcb4e96636a 100644 --- a/modules/oe_whitelabel_starter_event/oe_whitelabel_starter_event.post_update.php +++ b/modules/oe_whitelabel_starter_event/oe_whitelabel_starter_event.post_update.php @@ -28,12 +28,6 @@ function oe_whitelabel_starter_event_post_update_00002(): void { $configs = [ 'core.entity_view_display.node.oe_sc_event.full', 'core.entity_view_display.node.oe_sc_event.teaser', - 'core.date_format.oe_whitelabel_project_date', ]; - ConfigImporter::importMultiple( - 'module', - 'oe_whitelabel_starter_event', - '/config/post_updates/00002_event_date_show_time', - $configs, - ); + ConfigImporter::importMultiple('module', 'oe_whitelabel_starter_event', '/config/post_updates/00002_event_date_show_time', $configs); } diff --git a/tests/src/Functional/ContentEventRenderTest.php b/tests/src/Functional/ContentEventRenderTest.php index 1bf7c97916d27914bb5cbb5a42b6a1310a568624..68ca250510f12b86fcf3fd8189ecfef2c6911e03 100644 --- a/tests/src/Functional/ContentEventRenderTest.php +++ b/tests/src/Functional/ContentEventRenderTest.php @@ -152,7 +152,7 @@ class ContentEventRenderTest extends WhitelabelBrowserTestBase { $crawler = $client->getCrawler(); $date = $crawler->filter('dl > dd'); - $this->assertEquals('Tuesday 15 February 2022, 09.00 - Tuesday 22 February 2022, 19.00 (CET)', trim($date->text())); + $this->assertEquals('Tuesday 15 February 2022, 09.00 (CET) - Tuesday 22 February 2022, 19.00 (CET)', trim($date->text())); // Assert in-page navigation title. $this->assertEquals(