I am using Laravel 11 and trying to work with ISO 8601 intervals using Carbon. However, I encountered an issue where Carbon interprets P1M as 1 minute (60 seconds) instead of 1 month. This is causing problems with my time calculations.
$interval = CarbonInterval::fromString('P1M');
echo $interval->totalSeconds; // Outputs: 60 (expected: seconds for 1 month)
As a temporary workaround, I’m using P30D to represent approximately one month.
Is there a way to make Carbon correctly interpret P1M as 1 month? Or is there a better approach to handle this in Laravel 11?
Any advice or guidance would be appreciated!
1