Skip to content

Commit 97a8e97

Browse files
authored
Merge pull request #40 from assoconnect/flo_feature_improve_now
Add the possibility to not pass a DateTimeZone in now()
2 parents ef133fa + 22c36ca commit 97a8e97

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/AbsoluteDateClock.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
class AbsoluteDateClock
1111
{
12-
public static function now(\DateTimeZone $timeZone): AbsoluteDate
12+
public static function now(\DateTimeZone $timeZone = null): AbsoluteDate
1313
{
1414
return self::relative('now', $timeZone);
1515
}

tests/AbsoluteDateClockTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ public function testNow(): void
2525
);
2626
}
2727

28+
public function testNowWithoutDateTimeZone(): void
29+
{
30+
self::assertEquals(
31+
'2025-03-12',
32+
AbsoluteDateClock::now()
33+
);
34+
}
35+
2836
public function testRelative(): void
2937
{
3038
self::assertEquals(

0 commit comments

Comments
 (0)