-
Notifications
You must be signed in to change notification settings - Fork 163
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
Editorial: Remove duplicate steps in UnbalanceDateDurationRelative #2690
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2690 +/- ##
=======================================
Coverage ? 96.22%
=======================================
Files ? 20
Lines ? 11986
Branches ? 2227
=======================================
Hits ? 11534
Misses ? 389
Partials ? 63 ☔ View full report in Codecov by Sentry. |
Thanks! These look like good simplifications, but I agree with your assessment that they will be affected substantially by the pending PRs, and one or the other will have to rebase. I'll take your advice of revisiting this after they land. |
…DateDurationRelative The `DaysUntil` calls can at most modify `days` by 200,000,000, so the CreateDateDurationRecord calls are infallible.
This applies the spec changes in the previous commits to UnbalanceDateDurationRelative in the polyfill.
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.
I've taken another look at this now that #2727 has landed. I think a3ae84f and 2b91699 are no longer applicable because the loop is gone. That also affects the justification for 128562f, but the same 2e8 days limit applies to DaysUntil, so I think that still holds.
I had to add an extra call to LargerOfTwoTemporalUnits to account for the fact that this operation may now be called with largestUnit being a time unit (which is treated as "day") — that's the effectiveLargestUnit stuff.
I've rebased it and changed the reference code to correspond.
128562f
to
a5c5587
Compare
The call is now fallible again. The following test case calls let duration = Temporal.Duration.from({
weeks: 1,
days: Math.trunc((2**53) / 86_400),
});
let relativeTo = new Temporal.PlainDate(2000, 1, 1);
duration.total({
relativeTo,
unit: "days",
}); |
…owing Based on a test case by Anba. See tc39/proposal-temporal#2690 (comment)
…nbalanceDateDurationRelative" This reverts commit 5c59914. It was no longer correct that these calls to CreateDateDurationRecord were infallible. See #2690 (comment)
Thanks, see tc39/test262#4007 and #2770. |
…nbalanceDateDurationRelative" This reverts commit 5c59914. It was no longer correct that these calls to CreateDateDurationRecord were infallible. See #2690 (comment)
…nbalanceDateDurationRelative" This reverts commit 5c59914. It was no longer correct that these calls to CreateDateDurationRecord were infallible. See #2690 (comment)
…owing Based on a test case by Anba. See tc39/proposal-temporal#2690 (comment)
…owing Based on a test case by Anba. See tc39/proposal-temporal#2690 (comment)
…owing Based on a test case by Anba. See tc39/proposal-temporal#2690 (comment)
…owing Based on a test case by Anba. See tc39/proposal-temporal#2690 (comment)
Some parts of
UnbalanceDateDurationRelative
could be shared to reduce duplicated steps.These changes probably shouldn't be applied to the current spec, but instead this PR should be revisited after #2519 and #2612 have both landed. (Maybe mark this PR as a draft PR?)
c4f291f
74cfd4e
76841ba
a3ae84f
GetMethod
for"dateAdd"
can be shared, too.2b91699
years
andmonths
can be shared, too.128562f
MoveRelativeDate
can at most add ±200,000,000 days to the inputdays
value, so the call to CreateDateDurationRecord is infallible.