Skip to content
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

Improve test coverage for balancing up to weeks (when year/month) #2813

Open
arshaw opened this issue Mar 31, 2024 · 1 comment
Open

Improve test coverage for balancing up to weeks (when year/month) #2813

arshaw opened this issue Mar 31, 2024 · 1 comment
Labels
Milestone

Comments

@arshaw
Copy link
Contributor

arshaw commented Mar 31, 2024

I noticed fullcalendar's temporal-polyfill has an incorrect implementation of balancing days and smaller up to weeks when years or months are present. It was not getting caught by test262 tests. We should improve test coverage for this.

Temporal.Duration.from({ months: 1, days: 1 })
  .round({
    relativeTo: '2024-01-01',
    smallestUnit: 'weeks',
    roundingIncrement: 99,
    roundingMode: 'ceil'
  })
  .toString()

// temporal-polyfill: P2M (wrong)
// reference impl:    P1M99W (correct)

Things work fine in the reference implementation.

@catamorphism
Copy link
Contributor

This test case doesn't work as-is anymore:

Uncaught:
RangeError: For calendar units with roundingIncrement > 1, use largestUnit = smallestUnit

If largestUnit: 'weeks' is added, then the result is P99W.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants