Skip to content

Chronos::createFromFormat using a date without time does not respect Chronos::setTestNow #452

@holtkamp

Description

@holtkamp

It seems Chronos::setTestNow() only fixates the time and not the rest of a date, is that intended?

For example, when using Chronos::createFromFormat() with a partial format, things like the day and month are not fixated:

Chronos::setTestNow(new Chronos('2020-12-01 00:00:00'));
$date = Chronos::createFromFormat('m-d', '10-5'); // I would expect this to become "2020-10-05 00:00:00
$date = Chronos::createFromFormat('d', '5'); // I would expect this to become "2020-12-05 00:00:00

Note this is similar to briannesbitt/Carbon#1280

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions