-
Notifications
You must be signed in to change notification settings - Fork 189
Fix flaky 'micro formats years' test #342
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -523,14 +523,15 @@ suite('relative-time', function () { | |||||||||||||
| }) | ||||||||||||||
|
|
||||||||||||||
| test('micro formats years', async () => { | ||||||||||||||
| const datetime = new Date() | ||||||||||||||
| datetime.setFullYear(datetime.getFullYear() - 10) | ||||||||||||||
| // FIXME: there is still a bug, if the duration is long enough (say, 10 or 100 years) | ||||||||||||||
| // then the `month = Math.floor(day / 30)` in elapsedTime causes errors, then "10 years" would output "11y" | ||||||||||||||
|
Comment on lines
+526
to
+527
|
||||||||||||||
| // FIXME: there is still a bug, if the duration is long enough (say, 10 or 100 years) | |
| // then the `month = Math.floor(day / 30)` in elapsedTime causes errors, then "10 years" would output "11y" | |
| // FIXME: there is still a bug if the duration is long enough (say, 10 or 100 years): | |
| // the `month = Math.floor(day / 30)` in elapsedTime causes errors, so "10 years" would output "11y". | |
| // This test intentionally uses a shorter 2-year duration to exercise year micro-formatting ("2y") | |
| // without triggering that known long-duration rounding bug. |
Copilot
AI
Feb 17, 2026
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 now variable here is actually the target past datetime being set on the element, not the current time. Renaming it to something like datetime/pastDatetime would make the test easier to follow and reduce confusion with other tests that use now for the current timestamp.
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.
This test name is identical to the
[tense=future]suite'smicro formats yearstest later in the file, which can make failures harder to distinguish in test output/search. Renaming to include the tense (e.g., "micro formats years (past)") would make reporting clearer.