New issue
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
get the all dates of week #1191
Conversation
meteguerlek
commented
Mar 12, 2018
•
edited
edited
src/Carbon/Carbon.php
Outdated
*/ | ||
public static function getCurrentWeekDays() | ||
{ | ||
$startOfWeek = Carbon::instance((new static)->startOfWeek()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If change this to static::now()->startOfWeek()->subDay() you can then just loop from 0 to < DAYS_PER_WEEK and loop code will stay the same. This will get rid of the PHP 5.4+ array syntax as well, since we support 5.3 and higher.
Hi, For me this method is too user-specific (mostly when returning datetime strings rather than a date copy users can format as they want after that). Every feature in Carbon needs unit tests (that's why codecov does not pass). You also need to follow the code style of the project (check StyleCI details). It's also required to use constats ( I agree with @Glavic for the macro label, this could go in our future list of macros. |
Hi @kylekatarnls, its ok, this could go in the future list. But $weekDays[] = $startOfWeek->addDay(); not working. |
|
- new method getCurrentMonthDays()
Will appear in the documentation: |