From 57f944ffc48bfebfce1baba1130259824eb4e188 Mon Sep 17 00:00:00 2001 From: Jani Luoti Date: Fri, 31 May 2024 08:38:10 +0300 Subject: [PATCH] Fix New Zealand daylight saving time format to pass hasFormat. --- src/Carbon/Traits/Options.php | 6 +++--- tests/Carbon/IsTest.php | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Carbon/Traits/Options.php b/src/Carbon/Traits/Options.php index 48f97397..ffad4f14 100644 --- a/src/Carbon/Traits/Options.php +++ b/src/Carbon/Traits/Options.php @@ -96,9 +96,9 @@ trait Options 'v' => '([0-9]{1,3})', 'e' => '([a-zA-Z]{1,5})|([a-zA-Z]*\\/[a-zA-Z]*)', 'I' => '(0|1)', - 'O' => '([+-](1[012]|0[0-9])[0134][05])', - 'P' => '([+-](1[012]|0[0-9]):[0134][05])', - 'p' => '(Z|[+-](1[012]|0[0-9]):[0134][05])', + 'O' => '([+-](1[0123]|0[0-9])[0134][05])', + 'P' => '([+-](1[0123]|0[0-9]):[0134][05])', + 'p' => '(Z|[+-](1[0123]|0[0-9]):[0134][05])', 'T' => '([a-zA-Z]{1,5})', 'Z' => '(-?[1-5]?[0-9]{1,4})', 'U' => '([0-9]*)', diff --git a/tests/Carbon/IsTest.php b/tests/Carbon/IsTest.php index cd7012c5..1409a825 100644 --- a/tests/Carbon/IsTest.php +++ b/tests/Carbon/IsTest.php @@ -904,6 +904,9 @@ public function testHasFormat() $this->assertFalse(Carbon::hasFormat('1975-05-01', 'Y-*-d')); $this->assertTrue(Carbon::hasFormat('2012-12-04 22:59.32130', 'Y-m-d H:s.vi')); + + // New Zealand Daylight time + $this->assertTrue(Carbon::hasFormat('2024-03-02T00:00:00+13:00', 'Y-m-d\TH:i:sP')); } public function testHasFormatWithModifiers()