Hacker News new | ask | show | jobs
by ABoldGambit 2168 days ago
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?
3 comments

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
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).

Temporal is just the namespace. It has classes called DateTime, Date, Time, TimeZone, Duration etc.
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.