Skip to content

ZonedDateTime.startOfDay: is it guaranteed to be the first instant in a calendar day? #2910

Closed

Description

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

normativeWould be a normative change to the proposalspec-textSpecification text involved

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions