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

Fix FormattedRelativeTime with high seconds values #1385

Merged
merged 2 commits into from
Jul 29, 2019
Merged

Fix FormattedRelativeTime with high seconds values #1385

merged 2 commits into from
Jul 29, 2019

Conversation

djmarland
Copy link
Contributor

Affects: v3.0.0-beta.20

Expected:
For an item with an age of 3 days, on initial load don't add the timer but do show "3 days ago"

Actual:
Item shows "1 day ago" now matter how old it is

The FormattedRelativeTime intends to stop using a timer once it goes over one day. However, at the point it removes this timer it also fixes the value at one day, so the display can only ever be "1 day ago", which is incorrect.

This fix removes the overriding of the current state value, but continues to bypass the timer. It also adds a test for this case (which was failing before the fix)

Expected:
For an item with an age of 3 days, on initial load don't add the timer but do show "3 days ago"

Actual:
Item shows "1 day ago" now matter how old it is

The FormattedRelativeTime intends to stop using a timer once it goes over one day. However, at the point it removes this timer it also fixes the value at one day, so the display can only ever be "1 day ago", which is incorrect.

This fix removes the overriding of the current state value, but continues to bypass the timer. It also adds a test for this case (which was failing before the fix)
@longlho
Copy link
Member

longlho commented Jul 29, 2019

Thanks a lot for your contributions!

@longlho longlho merged commit a7f1dfa into formatjs:master Jul 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants