logoalt Hacker News

tshaddoxyesterday at 5:25 PM0 repliesview on HN

It's perfectly reasonable to default seconds, minutes, hours, etc. to zero in the Duration constructor. But for Instant, it doesn't make sense to default those to zero unless you specify time zone offset.

And indeed, the static method Instant.from does accept an RFC 9557 string, which requires a 2-digit hour and a time zone offset, but can omit minutes and seconds:

Temporal.Instant.from("2026-01-12T00+08:00")