-
Notifications
You must be signed in to change notification settings - Fork 171
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
Cannot get format=relative to display seconds #269
Comments
Sounds like this is a bug. Following the code I can't see where there's a problem. If you would kindly submit a PR with some failing tests we can investigate further. |
Of the non-deprecated formats, only
Tested with v4.3.1. I think I found the issue debugging with devtools:
relative-time-element/src/relative-time-element.ts Lines 444 to 445 in 7e40806
relative-time-element/src/relative-time-element.ts Lines 182 to 184 in 7e40806
Times in the past (like -X seconds) would always enter the if branch and format the value Maybe what was meant is: if (unit === 'second' && Math.abs(int) < 10) {
return relativeFormat.format(0, 'second');
} Such that we don't show "now", 1, 2, 3..., 9, but instead go "now", 10, 11, ... I'm not sure though, I think that's unspecified behavior. I traced it back to 6118a16. |
@keithamus I can confirm that second precision only work with |
@thiagomajesk I think I chose some format that worked well enough and moved on. |
I cannot get
relative
format to display second level precision. The docs suggest that the default precision is seconds and this table suggests that with format relative i should see seconds. But I only seenow
until 1 minute has passed.format=elapsed
works as i expect.The text was updated successfully, but these errors were encountered: