From 2706f2bc5520ca99ec4da1741513e02128d756af Mon Sep 17 00:00:00 2001
From: Aron Novak <aron@gizra.com>
Date: Fri, 21 Mar 2025 13:17:07 +0100
Subject: [PATCH 1/6] better tz handling

---
 src/IntlDate.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/IntlDate.php b/src/IntlDate.php
index 22e2926..e26a57c 100644
--- a/src/IntlDate.php
+++ b/src/IntlDate.php
@@ -104,7 +104,8 @@ class IntlDate {
     if (isset($map[$langcode])) {
       $locale = $map[$langcode];
     }
-    if (empty($timezone)) {
+
+    if (empty($timezone) || !in_array($timezone, timezone_identifiers_list())) {
       $timezone = NULL;
     }
     $formatter = new \IntlDateFormatter($locale, \IntlDateFormatter::FULL, \IntlDateFormatter::FULL, $timezone, NULL, $pattern);
-- 
GitLab


From eb19ad05beea851f056c0e2ac61e15f33c82feac Mon Sep 17 00:00:00 2001
From: Aron Novak <aron@gizra.com>
Date: Fri, 21 Mar 2025 13:20:29 +0100
Subject: [PATCH 2/6] add ci

---
 .gitlab-ci.yml | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)
 create mode 100644 .gitlab-ci.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..38da045
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,83 @@
+################
+# DrupalCI GitLabCI template
+#
+# Gitlab-ci.yml to replicate DrupalCI testing for Contrib
+#
+# With thanks to:
+#   * The GitLab Acceleration Initiative participants
+#   * DrupalSpoons
+################
+
+################
+# Guidelines
+#
+# This template is designed to give any Contrib maintainer everything they need to test, without requiring modification. It is also designed to keep up to date with Core Development automatically through the use of include files that can be centrally maintained.
+#
+# However, you can modify this template if you have additional needs for your project.
+################
+
+################
+# Includes
+#
+# Additional configuration can be provided through includes.
+# One advantage of include files is that if they are updated upstream, the changes affect all pipelines using that include.
+#
+# Includes can be overridden by re-declaring anything provided in an include, here in gitlab-ci.yml
+# https://docs.gitlab.com/ee/ci/yaml/includes.html#override-included-configuration-values
+################
+
+include:
+  ################
+  # DrupalCI includes:
+  # As long as you include this, any future includes added by the Drupal Association will be accessible to your pipelines automatically.
+  # View these include files at https://git.drupalcode.org/project/gitlab_templates/
+  ################
+  - project: $_GITLAB_TEMPLATES_REPO
+    ref: $_GITLAB_TEMPLATES_REF
+    file:
+      - '/includes/include.drupalci.main.yml'
+      # EXPERIMENTAL: For Drupal 7, remove the above line and uncomment the below.
+      # - '/includes/include.drupalci.main-d7.yml'
+      - '/includes/include.drupalci.variables.yml'
+      - '/includes/include.drupalci.workflows.yml'
+
+################
+# Pipeline configuration variables
+#
+# These are the variables provided to the Run Pipeline form that a user may want to override.
+#
+# Docs at https://git.drupalcode.org/project/gitlab_templates/-/blob/1.0.x/includes/include.drupalci.variables.yml
+################
+# variables:
+#   SKIP_ESLINT: '1'
+
+#
+# Start custom overrides.
+# Based on https://git.drupalcode.org/project/keycdn/-/blob/8.x-1.x/.gitlab-ci.yml
+#
+
+variables:
+  # #Disable default phpunit job in favor of the d9/10 variants below.
+  # SKIP_PHPUNIT: 1
+  # SKIP_COMPOSER: 1
+  # _PHPUNIT_EXTRA: --verbose
+
+  # Broaden test coverage.
+  OPT_IN_TEST_PREVIOUS_MAJOR: 1
+  OPT_IN_TEST_MAX_PHP: 1
+  OPT_IN_TEST_NEXT_MINOR: 1
+  OPT_IN_TEST_NEXT_MAJOR: 1
+  # Convenient, and we have no secrets.
+  _SHOW_ENVIRONMENT_VARIABLES: 1
+
+phpcs:
+  allow_failure: false
+
+phpstan:
+  allow_failure: false
+
+phpstan (next major):
+  allow_failure: true
+
+phpstan (next minor):
+  allow_failure: true
-- 
GitLab


From 9cac6dcd0963d29df4601269ad397a8d716e8d03 Mon Sep 17 00:00:00 2001
From: Aron Novak <aron@gizra.com>
Date: Fri, 21 Mar 2025 13:24:56 +0100
Subject: [PATCH 3/6] phpcs

---
 src/IntlDate.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/IntlDate.php b/src/IntlDate.php
index e26a57c..df3d9d8 100644
--- a/src/IntlDate.php
+++ b/src/IntlDate.php
@@ -90,7 +90,7 @@ class IntlDate {
    * @return false|string
    *   The formatted string or, if an error occurred, <b>FALSE</b>.
    */
-  public static function format(int $timestamp, string $pattern, string $langcode = NULL, string $timezone = NULL) {
+  public static function format(int $timestamp, string $pattern, ?string $langcode = NULL, ?string $timezone = NULL) {
     if (empty($langcode)) {
       $langcode = \Drupal::languageManager()->getCurrentLanguage()->getId();
     }
@@ -140,7 +140,7 @@ class IntlDate {
    * @return false|string
    *   The formatted string or, if an error occurred, <b>FALSE</b>.
    */
-  public static function formatPattern(int $timestamp, string $date_format, string $langcode = NULL, string $timezone = NULL) {
+  public static function formatPattern(int $timestamp, string $date_format, ?string $langcode = NULL, ?string $timezone = NULL) {
     $pattern = \Drupal::entityTypeManager()->getStorage('intl_date_format')->load($date_format);
     if (empty($pattern)) {
       throw new \IntlException('Invalid intl date format');
-- 
GitLab


From 2b4753bdb356911558a0bd9b373248b46ad720e0 Mon Sep 17 00:00:00 2001
From: Aron Novak <aron@gizra.com>
Date: Fri, 21 Mar 2025 13:29:44 +0100
Subject: [PATCH 4/6] drop d7 api function call

---
 src/Plugin/Field/FieldFormatter/IntlTimestampFormatter.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/Plugin/Field/FieldFormatter/IntlTimestampFormatter.php b/src/Plugin/Field/FieldFormatter/IntlTimestampFormatter.php
index 82adf5b..6be17b2 100644
--- a/src/Plugin/Field/FieldFormatter/IntlTimestampFormatter.php
+++ b/src/Plugin/Field/FieldFormatter/IntlTimestampFormatter.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\intl_date\Plugin\Field\FieldFormatter;
 
+use Drupal\Core\Datetime\TimeZoneFormHelper;
 use Drupal\Core\Field\FieldItemListInterface;
 use Drupal\Core\Field\Plugin\Field\FieldFormatter\TimestampFormatter;
 use Drupal\Core\Form\FormStateInterface;
@@ -75,7 +76,7 @@ class IntlTimestampFormatter extends TimestampFormatter {
     $elements['timezone'] = [
       '#type' => 'select',
       '#title' => $this->t('Time zone'),
-      '#options' => ['' => $this->t('- Default site/user time zone -')] + system_time_zones(FALSE, TRUE),
+      '#options' => ['' => $this->t('- Default site/user time zone -')] + TimeZoneFormHelper::getOptionsListByRegion(),
       '#default_value' => $this->getSetting('timezone'),
     ];
 
-- 
GitLab


From d965adb87bd18be1b4db95d54cad3dea567338f0 Mon Sep 17 00:00:00 2001
From: Aron Novak <aron@gizra.com>
Date: Fri, 21 Mar 2025 13:37:35 +0100
Subject: [PATCH 5/6] spell ignore

---
 .gitlab-ci.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 38da045..c2abfdb 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -57,6 +57,7 @@ include:
 #
 
 variables:
+  _CSPELL_IGNORE_PATHS: '"**/.*.json",".*ignore","composer.json","composer.lock","**/LICENSE.txt","package.json","yarn.lock",tests/**'
   # #Disable default phpunit job in favor of the d9/10 variants below.
   # SKIP_PHPUNIT: 1
   # SKIP_COMPOSER: 1
-- 
GitLab


From 007bec979c2d8ba64f305edc853a4f85c4b92d83 Mon Sep 17 00:00:00 2001
From: Aron Novak <aron@gizra.com>
Date: Fri, 21 Mar 2025 14:44:53 +0100
Subject: [PATCH 6/6] allow stan failure

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c2abfdb..f95f0e2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -75,7 +75,7 @@ phpcs:
   allow_failure: false
 
 phpstan:
-  allow_failure: false
+  allow_failure: true
 
 phpstan (next major):
   allow_failure: true
-- 
GitLab