You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to cover dates up until a maximum value of 13 billion years, however "the range of allowed values for this type is the same as the old-style JavaScript Date, 100 million days".
Is there a reason to cap it at 10^8?
As temporal uses bigint, there is no boundary to the size of epochNanoseconds.
The text was updated successfully, but these errors were encountered:
There does need to be a cap — we've received a strong signal about this from browser implementors, who would otherwise be concerned about Temporal objects having unbounded storage requirements.
There are a few other concerns about not having a cap:
beyond a certain point you'd have to make the year field of PlainDate, PlainDateTime, PlainYearMonth, and ZonedDateTime a bigint as well, which would be cumbersome for most normal usage of Temporal.
the ISO 8601 interchange format requires defining a particular number of digits for the expanded year format (±YYYYYY-MM-DD) that consumers should be able to expect, you are not allowed to emit variable numbers of digits. So beyond a certain point we'd have to decline to serialize some objects and toString() would have to throw instead.
A while back, I wrote a cookbook example of how you might override certain Temporal methods in order to implement Temporal-like objects that supported an arbitrary range of years: https://tc39.es/proposal-temporal/docs/cookbook-expandedyears.html Maybe this approach would be good for your use case? (Although, I suspect you'd probably be better off using a dedicated 3rd-party library instead...)
You can find more discussion on this topic in #24 and #198. I hope that answers your question!
I would like to cover dates up until a maximum value of 13 billion years, however "the range of allowed values for this type is the same as the old-style JavaScript
Date
, 100 million days".Is there a reason to cap it at 10^8?
As temporal uses
bigint
, there is no boundary to the size ofepochNanoseconds
.The text was updated successfully, but these errors were encountered: