Closed jamesRUS52 closed 5 months ago
Hello,
I encountered an issue with the following code:
$t1 = now(); $t2 = now()->addMinutes(2); $p = $t1->diffAsCarbonInterval($t2); $p->addSeconds(10); echo $p->locale('en_US')->forHumans(); echo PHP_EOL; echo $p->totalSeconds; // Carbon 3.1.1 //2 minutes 10 seconds //120.000011 echo $p->locale('en_US')->forHumans(); echo PHP_EOL; echo $p->totalSeconds; // Carbon 2.71.0 //2 minutes 10 seconds //130.000011
After adding additional interval to another one, it not calculated in totalSeconds, but it correct in Human presentation. And it work well at Carbon v2
Carbon version: 3.1.1
PHP version: 8.3
I expected to get:
130
But I actually get:
120
Thanks!
OK, I see the problem, the interval remember the start and end used to create it, but we need to forget them as soon as the interval is altered again.
Hello,
I encountered an issue with the following code:
After adding additional interval to another one, it not calculated in totalSeconds, but it correct in Human presentation. And it work well at Carbon v2
Carbon version: 3.1.1
PHP version: 8.3
I expected to get:
But I actually get:
Thanks!