3 ms·
I think that it's nice it's explicit that the method returns the current instant, rather than some other zero value. There's also other methods that return oth
by sheept 7mo ago
I think that it's nice it's explicit that the method returns the current instant, rather than some other zero value.
There's also other methods that return other types, like
const now = Temporal.Now.instant()
which isn't as bad.
One could argue that the ugliness of the API intentionally reveals the ugliness of datetime. It forces you to really think about what you mean when you want "the current date time," which I think is one of the goals of the API.
- Bratmon 7mo agoWhat would have been wrong with Temporal.now() returning a sensible value?
- ejplatzer 7mo agoWhat counts as a sensible value? The whole point of the library is to be explicitly about what kind of date/time data you're working with, because different kinds of data have to be handled in very different ways.
- Bratmon 7mo agoIf they at least had a Temporal.nowlocal() and a Temporal.nowUTC() that returned a ZonedDateTime set to the local and UTC timezones respectively, that would be 95% of what developers need in practice.