Open holtkamp opened 2 months ago
This is using the default behavior of DateTimeImmutalbe;:createFromFormat(). I don't think we'll be able to detect a time component wasn't included in the format.
@othercorey thanks for the swift response. Indeed the native DateTimeImmutable::createFromFormat()
does not support providing an alternative clock.
Maybe this can be used as inspiration: https://github.com/briannesbitt/Carbon/pull/1281
Which seem to have landed here after 6 years: https://github.com/briannesbitt/Carbon/blob/8275fbf2f47c8a792cda010d56b7fe62c3eeafbb/src/Carbon/Traits/Creator.php#L602-L613
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:
Note this is similar to https://github.com/briannesbitt/Carbon/issues/1280