Description
openedon Jul 3, 2024
I've been trying to write down a contract for the analog to ZonedDateTime.startOfDay
in my own Temporal-inspired Rust library. The main contract in the Temporal docs is:
Returns: A new Temporal.ZonedDateTime instance representing the earliest valid local clock time during the current calendar day and time zone of zonedDateTime.
I am wondering whether this is true in all cases. I don't know of any such real world case where the above contract wouldn't be upheld, so it's not easy for me to test, but what happens if there is a time zone transition forwards that includes midnight but doesn't start at midnight? For example, maybe there is a 1 hour gap starting at 23:30:00
. Since startOfDay
will use the "compatible" disambiguation strategy and since the implementation (as I understand it) works by looking for an instant at 00:00:00
, I believe this will result in returning the instant corresponding to 01:00:00
. But the first instant of the day in this particular example is 00:30:00
.
cc @arshaw I believe the fullcalendar polyfill uses the same implementation technique of starting from midnight and using the "compatible" disambiguation strategy.