We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello,
I encountered an issue with the following code:
echo Carbon::parse('2018-06-15')->isoFormat('Do');
Carbon version: 2.56.0
PHP version: 8.1.2
I expected to get:
15th
But I actually get:
"Error: Implicit conversion from float 1.5 to int loses precision"
The issue is in src/Carbon/Lang/en.php on line 75:
'ordinal' => function ($number) { $lastDigit = $number % 10; return $number.( (~~($number % 100 / 10) === 1) ? 'th' : ( ($lastDigit === 1) ? 'st' : ( ($lastDigit === 2) ? 'nd' : ( ($lastDigit === 3) ? 'rd' : 'th' ) ) ) ); },
Specifically in:
~~($number % 100 / 10) === 1
Thanks!
The text was updated successfully, but these errors were encountered:
Fixes briannesbitt#2549
e11a98e
Compare float to float, not float to int
Thanks for the report.
For the record, I can't reproduce as an "Error" I can only get "Deprecated: Implicit conversion from float 1.5 to int loses precision".
Normally this will only happen with E_DEPRECATED on and will become an error only in PHP 9.
E_DEPRECATED
Sorry, something went wrong.
Add unit tests for case #2549
41b4fde
Successfully merging a pull request may close this issue.
Hello,
I encountered an issue with the following code:
Carbon version: 2.56.0
PHP version: 8.1.2
I expected to get:
But I actually get:
The issue is in src/Carbon/Lang/en.php on line 75:
Specifically in:
Thanks!
The text was updated successfully, but these errors were encountered: