-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert Instant/ZonedDateTime -> Date #2769
Comments
Thanks for taking the time to give feedback! There's more background on this decision in #515 and #751 if you'd like more reading material. Direct conversion between legacy Date and ZonedDateTime is actually something that we intentionally omitted. The data model of Date does not include a time zone, although many developers incorrectly believe that it does because it has two methods for each unit such as Although I can't find it documented anywhere now, if my memory serves, we considered that At this stage of the proposal, the scope is nailed down and we aren't going to add new methods. If you'd like, you can open an issue at js-temporal/proposal-temporal-v2 and we can track whether we get a lot of requests for it. |
Okay, I filed an issue for v2: js-temporal/proposal-temporal-v2#31 Though I'll go on record that I'm skeptical on adoption without having an easy(ier) Temporal <-> Date conversion. |
Converting to Date currently requires:
This is awkward, and requires remembering the unit for Dates. (seconds? millis? nanos?)
I suggest offering convenience functions:
For adoption, it's important that converting to/from Dates is easy and rebost.
The text was updated successfully, but these errors were encountered: