-
Notifications
You must be signed in to change notification settings - Fork 464
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
Temporal: Add test for balancing up to weeks when year/month are present #4305
base: main
Are you sure you want to change the base?
Conversation
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.
Thanks!
test/built-ins/Temporal/Duration/prototype/round/balances-up-to-weeks.js
Outdated
Show resolved
Hide resolved
test/built-ins/Temporal/Duration/prototype/round/balances-up-to-weeks.js
Outdated
Show resolved
Hide resolved
---*/ | ||
|
||
const oneMonthOneDay = new Temporal.Duration(0, 1, 0, 1, 0, 0, 0, 0, 0, 0); | ||
const oneYearOneMonthOneDay = new Temporal.Duration(1, 1, 0, 1, 0, 0, 0, 0, 0, 0); |
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'd suggest something like
const relativeTo = new Temporal.PlainDate(2024, 1, 1);
and using that in the options bags throughout.
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.
Also, I've been looking at the existing tests in round/
and I think we might not have coverage of rounding a duration with only days up to weeks. So maybe add something like
const severalWeeksInDays = new Temporal.Duration(0, 0, 0, 29, 0, 0, 0, 0, 0, 0);
(I might have missed it if we already had coverage of this, though! There are a lot of tests in this folder)
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.
Done and done.
…o-weeks.js Co-authored-by: Philip Chimento <[email protected]>
…o-weeks.js Co-authored-by: Philip Chimento <[email protected]>
See tc39/proposal-temporal#2813