@@ -490,8 +490,8 @@ public function test_minus_methods(): void
490490 $ this ->assertSame (59 , $ datetime ->minusSeconds (1 )->getSeconds ());
491491 $ this ->assertSame (59 , $ datetime ->minusSecond ()->getSeconds ());
492492
493- $ this ->assertSame (999999999 , $ datetime ->minusNanoseconds (1 )->getNanoseconds ());
494- $ this ->assertSame (999999999 , $ datetime ->minusNanosecond ()->getNanoseconds ());
493+ $ this ->assertSame (999_999_999 , $ datetime ->minusNanoseconds (1 )->getNanoseconds ());
494+ $ this ->assertSame (999_999_999 , $ datetime ->minusNanosecond ()->getNanoseconds ());
495495 }
496496
497497 public function test_minus_months_edge_cases (): void
@@ -633,6 +633,72 @@ public function test_end_of_day(): void
633633 $ this ->assertSame (999999999 , $ new ->getNanoseconds ());
634634 }
635635
636+ public function test_start_of_week (): void
637+ {
638+ $ date = DateTime::parse ('2025-05-21 12:00 ' );
639+ $ new = $ date ->startOfWeek ();
640+
641+ $ this ->assertSame (5 , $ new ->getMonth ());
642+ $ this ->assertSame (19 , $ new ->getDay ());
643+ $ this ->assertSame (0 , $ new ->getHours ());
644+ }
645+
646+ public function test_end_of_week (): void
647+ {
648+ $ date = DateTime::parse ('2025-05-21 12:00 ' );
649+ $ new = $ date ->endOfWeek ();
650+
651+ $ this ->assertSame (5 , $ new ->getMonth ());
652+ $ this ->assertSame (25 , $ new ->getDay ());
653+ $ this ->assertSame (23 , $ new ->getHours ());
654+ $ this ->assertSame (59 , $ new ->getMinutes ());
655+ $ this ->assertSame (59 , $ new ->getSeconds ());
656+ }
657+
658+ public function test_start_of_month (): void
659+ {
660+ $ date = DateTime::parse ('2025-05-21 12:00 ' );
661+ $ new = $ date ->startOfMonth ();
662+
663+ $ this ->assertSame (5 , $ new ->getMonth ());
664+ $ this ->assertSame (1 , $ new ->getDay ());
665+ $ this ->assertSame (Weekday::THURSDAY , $ new ->getWeekday ());
666+ $ this ->assertSame (0 , $ new ->getHours ());
667+ }
668+
669+ public function test_end_of_month (): void
670+ {
671+ $ date = DateTime::parse ('2025-05-21 12:00 ' , timezone: Timezone::EUROPE_PARIS );
672+ $ new = $ date ->endOfMonth ();
673+
674+ $ this ->assertSame (5 , $ new ->getMonth ());
675+ $ this ->assertSame (31 , $ new ->getDay ());
676+ $ this ->assertSame (Weekday::SATURDAY , $ new ->getWeekday ());
677+ $ this ->assertSame (23 , $ new ->getHours ());
678+ $ this ->assertSame (59 , $ new ->getMinutes ());
679+ $ this ->assertSame (59 , $ new ->getSeconds ());
680+ }
681+
682+ public function test_end_of_month_edge_cases (): void
683+ {
684+ $ date = DateTime::parse ('2025-02-21 12:00 ' );
685+ $ this ->assertSame (2 , $ date ->endOfMonth ()->getMonth ());
686+ $ this ->assertSame (28 , $ date ->endOfMonth ()->getDay ());
687+ $ this ->assertSame (Weekday::FRIDAY , $ date ->endOfMonth ()->getWeekday ());
688+
689+ $ date = DateTime::parse ('2024-02-21 12:00 ' );
690+ $ this ->assertSame (2 , $ date ->endOfMonth ()->getMonth ());
691+ $ this ->assertSame (29 , $ date ->endOfMonth ()->getDay ());
692+ $ this ->assertSame (Weekday::THURSDAY , $ date ->endOfMonth ()->getWeekday ());
693+
694+ $ date = DateTime::parse ('2024-12-31 12:00 ' );
695+ $ this ->assertSame (12 , $ date ->endOfMonth ()->getMonth ());
696+ $ this ->assertSame (31 , $ date ->endOfMonth ()->getDay ());
697+ $ this ->assertSame (23 , $ date ->endOfMonth ()->getHours ());
698+ $ this ->assertSame (59 , $ date ->endOfMonth ()->getMinutes ());
699+ $ this ->assertSame (59 , $ date ->endOfMonth ()->getSeconds ());
700+ }
701+
636702 public function test_timezone_info (): void
637703 {
638704 $ timeZone = Timezone::EUROPE_BRUSSELS ;
0 commit comments