Skip to content

Commit ae20e2b

Browse files
authored
Merge pull request #3030 from Luoti/fix-new-zealand-time-zone
Fix New Zealand daylight saving time format to pass hasFormat
2 parents 57fbbf8 + 57f944f commit ae20e2b

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/Carbon/Traits/Options.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ trait Options
9696
'v' => '([0-9]{1,3})',
9797
'e' => '([a-zA-Z]{1,5})|([a-zA-Z]*\\/[a-zA-Z]*)',
9898
'I' => '(0|1)',
99-
'O' => '([+-](1[012]|0[0-9])[0134][05])',
100-
'P' => '([+-](1[012]|0[0-9]):[0134][05])',
101-
'p' => '(Z|[+-](1[012]|0[0-9]):[0134][05])',
99+
'O' => '([+-](1[0123]|0[0-9])[0134][05])',
100+
'P' => '([+-](1[0123]|0[0-9]):[0134][05])',
101+
'p' => '(Z|[+-](1[0123]|0[0-9]):[0134][05])',
102102
'T' => '([a-zA-Z]{1,5})',
103103
'Z' => '(-?[1-5]?[0-9]{1,4})',
104104
'U' => '([0-9]*)',

tests/Carbon/IsTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,9 @@ public function testHasFormat()
904904
$this->assertFalse(Carbon::hasFormat('1975-05-01', 'Y-*-d'));
905905

906906
$this->assertTrue(Carbon::hasFormat('2012-12-04 22:59.32130', 'Y-m-d H:s.vi'));
907+
908+
// New Zealand Daylight time
909+
$this->assertTrue(Carbon::hasFormat('2024-03-02T00:00:00+13:00', 'Y-m-d\TH:i:sP'));
907910
}
908911

909912
public function testHasFormatWithModifiers()

0 commit comments

Comments
 (0)