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

How can I solve "laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system"? - development

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

Angular.js ng-click with mouse middle button