Carbon icon indicating copy to clipboard operation
Carbon copied to clipboard

diffForHumans gives wrong amount of days

Open Slubby opened this issue 2 years ago • 0 comments

Hello,

I encountered an issue with the following code:

$deletedDate = Carbon::now()->startOfDay()->addDays(31);

echo $deletedDate->diffForHumans(Carbon::now()->startOfDay(), [
    'syntax' => CarbonInterface::DIFF_ABSOLUTE,
    'skip' => ['m', 'w'],
    'minimumUnit' => 'd'
]);;

Carbon version: 2.61.0

PHP version: 8.1.8

I expected to get:

31 days

But I actually get:

28 days

Thanks!

Slubby avatar Sep 15 '22 21:09 Slubby