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
If we drop PHP 8.0, using enums for week days, months and units is an option to be able write chaining in a more natural way, such as:
echo \Carbon\WeekDay::Monday->locale('it')->dayName; // lunedì // equivalent to: echo \Carbon\CarbonImmutable::parse('Monday')->locale('it')->dayName; // lunedì
echo \Carbon\Month::January->locale('it')->monthName; // gennaio // equivalent to: echo \Carbon\CarbonImmutable::parse('January 1st')->locale('it')->monthName; // gennaio
foreach (\Carbon\Unit::Week->stepBy('day') as $day) { $days[] = "$day"; } // equivalent to: foreach (\Carbon\CarbonInterval::week()->stepBy('day') as $day) { $days[] = "$day"; }
Those enums could also be supported in weekday(\Carbon\WeekDay|int $day) or month(\Carbon\Month|int $month)
weekday(\Carbon\WeekDay|int $day)
month(\Carbon\Month|int $month)
The text was updated successfully, but these errors were encountered:
Implement WeekDay, Month and Unit enums
6833fdf
Resolves #2701
7484a40
ec6043a
kylekatarnls
No branches or pull requests
If we drop PHP 8.0, using enums for week days, months and units is an option to be able write chaining in a more natural way, such as:
Those enums could also be supported in
weekday(\Carbon\WeekDay|int $day)
ormonth(\Carbon\Month|int $month)
The text was updated successfully, but these errors were encountered: