Carbon – disable the default year setting - development

Carbon – disable the default year setting

as we all know, Carbon is setting the default year by the current year when we parse a date without specifying a year.

Is it possible to disable the “setting the default year” behavior when parsing a date?

Example

$myDate = Carbon::parse('dec 25');

myDate must return null when getting the year property.

$myDate->year; // MUST RETURN NULL;

Thanks for help.



from Laravel Questions and Answers https://laravelquestions.com/laravel/carbon-disable-the-default-year-setting/
via Lzo Media

Comments

Popular posts from this blog

HTTP 401 Unable to create record Twillio PHP sdk 5.16 - development

ng-include of inline SVG does not display gradient except in Chrome

Using PHP and MySQL data to generate PDF letters like in MS Word mailmerge functionality - development