logoalt Hacker News

zvqcMMV6Zcryesterday at 4:16 PM1 replyview on HN

I am not sure if I like mixing value and formatting in single object. On other hand anything will be an improvement compared to that terrible old API.


Replies

happytoexplainyesterday at 4:36 PM

Temporal objects do not store formatting information. Unless you mean e.g. dropping the time, using a different time zone, etc - but those aren't formatting changes, they logically change the semantics of the data. Just like `myInt += 1` is not changing the "formatting" of `myInt`.

Remember: Date and Temporal objects are logically different things. A Date represents an absolute point in time (a timestamp), while a Temporal object represents a human time (calendar date, clock time, time zone). The fact that Dates are used to represent human time for lack of a better structure is the entire problem statement - the hole that all these other APIs like Temporal try to fill in.

show 1 reply