Re:Dates and Times in JavaScript – A New API for Dates from ...
by ABoldGambit on Thursday July 09, 2020 @01:57PM
(#23783012)
Great proposal, but Temporal is a poor name. Why not, in the age of the import keyword, finally just have a standard library, and import Date from std like a proper programming language?
[ Parent
| on HN ]
Re:Dates and Times in JavaScript – A New API for Dates from ...
by runarberg on Thursday July 09, 2020 @02:40PM
(#23783519)
There is a proposal for that[1] which introduces a `js:` pseudo-protocol for importing a build in module (or a standard library):
import Temporal from "js:temporal";
1: https://github.com/tc39/proposal-built-in-modules
Re:Dates and Times in JavaScript – A New API for Dates from ...
by hyperpape on Thursday July 09, 2020 @03:18PM
(#23783971)
I agree Temporal is an odd name for the object representing an Instant. But it shouldn't be Date either. A Date does not have a time associated with it.
Java really did a good job here: Instant, LocalDate, LocalDateTime, ZonedDateTime. (If they hadn't already had java.util.Date, they probably could've replaced LocalDate/LocalDateTime with Date/DateTime, but that ship sailed).
Re:Dates and Times in JavaScript – A New API for Dates from ...
by cwp on Friday July 10, 2020 @03:35AM
(#23789097)
Temporal is just the namespace. It has classes called DateTime, Date, Time, TimeZone, Duration etc.
Re:Dates and Times in JavaScript – A New API for Dates from ...
by politelemon on Thursday July 09, 2020 @02:37PM
(#23783495)
I agree, I think there should have been some drop-in replacement which would allow old scripts to continue working but also let new work make use of these improvements with `Date`. I feel that this duality will persist for a long time, and it can lead to answers, documentation and codebases becoming a confusing mess. It's hard to predict exactly what this mess will look like, only... er... Time will tell.