Skip to content

Commit

Permalink
Merge pull request #3030 from Luoti/fix-new-zealand-time-zone
Browse files Browse the repository at this point in the history
Fix New Zealand daylight saving time format to pass hasFormat
  • Loading branch information
kylekatarnls committed May 31, 2024
2 parents 57fbbf8 + 57f944f commit ae20e2b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Carbon/Traits/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]*)',
Expand Down
3 changes: 3 additions & 0 deletions tests/Carbon/IsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit ae20e2b

Please sign in to comment.