I want to change weekendDays
to only include Sunday in my Carbon Instance. How can I do that?
Advertisement
Answer
Run:
Carbon::setWeekendDays([Carbon::SUNDAY]);
In your AppProvidersAppServiceProvider in the boot function.
Edit:
setWeekendDays
is deprecated. Use macro instead.
Carbon::macro('isDayOff', function ($date) { return $date->isSunday(); }); $isDayOff = $carbon_inst->isDayOff(): bool;