From 22c36ca9956a956127d42f2f3af1b261c79254d2 Mon Sep 17 00:00:00 2001 From: Florian Guimier Date: Fri, 23 Jan 2026 11:58:30 +0100 Subject: [PATCH] Add the possibility to not pass a DateTimeZone in now() --- src/AbsoluteDateClock.php | 2 +- tests/AbsoluteDateClockTest.php | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/AbsoluteDateClock.php b/src/AbsoluteDateClock.php index a129c15..089eb20 100644 --- a/src/AbsoluteDateClock.php +++ b/src/AbsoluteDateClock.php @@ -9,7 +9,7 @@ class AbsoluteDateClock { - public static function now(\DateTimeZone $timeZone): AbsoluteDate + public static function now(\DateTimeZone $timeZone = null): AbsoluteDate { return self::relative('now', $timeZone); } diff --git a/tests/AbsoluteDateClockTest.php b/tests/AbsoluteDateClockTest.php index fea62f9..1162ff3 100644 --- a/tests/AbsoluteDateClockTest.php +++ b/tests/AbsoluteDateClockTest.php @@ -25,6 +25,14 @@ public function testNow(): void ); } + public function testNowWithoutDateTimeZone(): void + { + self::assertEquals( + '2025-03-12', + AbsoluteDateClock::now() + ); + } + public function testRelative(): void { self::assertEquals(