File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -110,9 +110,9 @@ public static function withMonthAndFraction(
110110 if ($ fractionOfMonth === 1.0 ) {
111111 $ effectiveTill = $ month ->modify ('+1 month ' );
112112 } else {
113- $ monthDays = ( int ) $ month-> format ( ' t ' );
114- $ days = ( int ) round ( $ monthDays * $ fractionOfMonth) ;
115- $ effectiveTill = $ effectiveSince ->modify (sprintf ('+%d days ' , $ days ));
113+ $ interval = new self ( $ month, $ nextMonth );
114+ $ seconds = $ interval -> secondsInMonth () * $ fractionOfMonth ;
115+ $ effectiveTill = $ effectiveSince ->modify (sprintf ('+%d seconds ' , $ seconds ));
116116 }
117117
118118 return new self (
Original file line number Diff line number Diff line change @@ -227,9 +227,9 @@ public function provideWithMonthAndFraction()
227227 [
228228 'start ' => '2024-02-01 11:50:00 ' ,
229229 'end ' => '2024-02-29 18:15:00 ' ,
230- 'ratioOfMonth ' => 0.97473659003831 ,
231- 'seconds ' => 2_419_200 ,
232- 'secondsInMonth ' => 2_419_200 ,
230+ 'ratioOfMonth ' => 0.9747365900383141 ,
231+ 'seconds ' => 2_442_300 ,
232+ 'secondsInMonth ' => 2_505_600 ,
233233 ]
234234 ];
235235 }
You can’t perform that action at this time.
0 commit comments