Skip to content

Anchor a civil date and time of day to an instant. - #16

Merged
gustavofreze merged 1 commit into
mainfrom
feat/local-date-at-time
Jul 31, 2026
Merged

Anchor a civil date and time of day to an instant.#16
gustavofreze merged 1 commit into
mainfrom
feat/local-date-at-time

Conversation

@gustavofreze

Copy link
Copy Markdown
Member

A LocalDate and a TimeOfDay are both civil values, and the library could only project the other way, from an instant to a local date. The timezone is what closes the round trip.

Daylight saving leaves two civil times that are not one-to-one with the timeline, and both resolve deterministically instead of raising. A time inside the spring-forward gap maps to the same instant as the first civil time after the gap, and a time inside the fall-back overlap maps to the earlier of the two. Raising would break a caller iterating a slot grid across a transition, which is the case this method exists for.

Please follow the contributing guidelines.

Summary

What this pull request does.

Related issue

Closes #...

Checklist

  • Tests added or updated.
  • Documentation updated when applicable.
  • composer review passes.
  • composer tests passes.

A LocalDate and a TimeOfDay are both civil values, and the library
could only project the other way, from an instant to a local date.
The timezone is what closes the round trip.

Daylight saving leaves two civil times that are not one-to-one with
the timeline, and both resolve deterministically instead of raising.
A time inside the spring-forward gap maps to the same instant as the
first civil time after the gap, and a time inside the fall-back
overlap maps to the earlier of the two. Raising would break a caller
iterating a slot grid across a transition, which is the case this
method exists for.
@gustavofreze
gustavofreze merged commit 4a8f616 into main Jul 31, 2026
7 checks passed
@gustavofreze
gustavofreze deleted the feat/local-date-at-time branch July 31, 2026 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant