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:
Carbon::parse('February')->format('M');
Carbon version: PUT HERE YOUR CARBON VERSION (exact version, not the range)
PHP version: PUT HERE YOUR PHP VERSION
I expected to get:
Feb
But I actually get:
Mar
Thanks!
The text was updated successfully, but these errors were encountered:
This comes directly from PHP parent class:
echo (new DateTime('February'))->format('M');
https://3v4l.org/4M2nr
It uses "now" as the start point and wants to keep the same day number so 29 then it does not find it in February and overflow to March.
The solution is to use an explicit start of point that does not trigger overflow such as the start of the month:
echo Carbon::now()->startOfMonth()->modify('February')->format('M');
Sorry, something went wrong.
No branches or pull requests
Hello,
I encountered an issue with the following code:
Carbon version: PUT HERE YOUR CARBON VERSION (exact version, not the range)
PHP version: PUT HERE YOUR PHP VERSION
I expected to get:
But I actually get:
Thanks!
The text was updated successfully, but these errors were encountered: