cakephp / chronos

A standalone DateTime library originally based off of Carbon
http://book.cakephp.org/chronos
MIT License
1.36k stars 63 forks source link

RFC - Changing default time values for Chronos::create() #419

Closed othercorey closed 1 year ago

othercorey commented 1 year ago

We would like to get feedback from the community on an idea for the time values in Chronos::create() for Chronos 3.

Current Behavior

The signature for Chronos::create() currently looks like this:

create(?int $year = null, ?int $month = null, ?int $day = null, ?int $hour = null, ?int $minute = null, ?int $second = null, ?int $microsecond = null, DateTimeZone|string|null $timezone = null):

The current behavior is:

Examples:

Chronos::create(2023, 1, 1);

Will use now for the hour, minute second and microsecond.

Chronos::create(2023, 1, 1, 0);

Will use 0 for the hour, minute second and microsecond.

Issues

Proposal

Change the default values for $hour, $minute, $second and $microsecond to 0.

Users can still specify null to get now, but they will have to specify it for all time components. There are simpler ways to create a Chronos instance of now so this doesn't feel like a harsh requirement.

othercorey commented 1 year ago

We've decided against this change for now.