Skip to content

[13.x] Fix duration helpers truncating float values - #61825

Merged
taylorotwell merged 2 commits into
laravel:13.xfrom
xurshudyan:float-duration-helpers
Oct 2, 2026
Merged

taylorotwell merged 2 commits into
laravel:13.xfrom
xurshudyan:float-duration-helpers

Conversation

@xurshudyan

Copy link
Copy Markdown
Contributor

Since #58006 the seconds(), minutes(), hours() and days() helpers accept floats, but the decimal part is dropped:

hours(0.5)->totalSeconds;              // 0, expected 1800
Cache::put('key', 'value', hours(0.5)); // nothing is stored

This uses CarbonInterval::make() so the fraction is kept. Integers behave the same as before.

@taylorotwell
taylorotwell merged commit 2b44ae8 into laravel:13.x Oct 2, 2026
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants