-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Min/max values for all types #402
Conversation
This includes a commit with a proposed resolution for #396, so we should make sure that is the consensus before merging this. |
Codecov Report
@@ Coverage Diff @@
## main #402 +/- ##
==========================================
+ Coverage 86.46% 86.82% +0.36%
==========================================
Files 17 17
Lines 3450 3545 +95
Branches 399 427 +28
==========================================
+ Hits 2983 3078 +95
+ Misses 436 435 -1
- Partials 31 32 +1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes seem fine, assuming we agree on the limits.
It looked like there was general agreement in #24 and #198 about the limits, though since this depends on the fix from #396 I would nonetheless not want to merge this yet. I'll merge the misc. bugfixes to master, but keep the limit commits in this pull request until #396 is resolved. EDIT: Ah, never mind, it's not possible to merge only part of a PR without creating a new PR |
This return value is always the same as what's passed in, so there's no need for it.
Two pull requests crossed each other mid-flight.
Practically speaking the limits of Absolute were already the same as the limits of old-style JavaScript Date, because we go through Date.UTC() to get the number of milliseconds. This adds tests and fixes to get the edge cases right.
- DateTime's limits are exactly enough to represent any Absolute in any valid TimeZone (offset -24 to +24 hours, exclusive at both boundaries.) - Date's limits are exactly enough that a call of getDate() on any valid DateTime succeeds. - YearMonth's limits are exactly enough that a call of getYearMonth() on any valid Date succeeds. This also means that the inverse conversions of those mentioned above can fail. If they are called in 'constrain' disambiguation mode, then they'll be clamped to the nearest in-range value for the resulting type. The 'balance' mode can't do anything in this case, so it'll behave like 'reject'. Also ensures that plus() and minus() can't have results that are out of the range. See: #24.
Duration's lower limit is 0. It has no upper limit for any of its fields, but they cannot be so large that their Number representation becomes Infinity. When serializing them, we format the numbers using BigInt.toString() in order to avoid printing them in scientific notation, which would be an invalid ISO 8601 string.
Rebased on #396. |
Closes: #24