-
Notifications
You must be signed in to change notification settings - Fork 2
fix: make sure the diff is always positive #93
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
Conversation
|
I have tried different approaches and this is the only one that has worked for me. As far as I can see the value is always correct, it just has a '-' in front of it. The fix is verified by checking that it works on my phone, which has been showing negative numbers until this fix. |
src/GeoLocationAge.tsx
Outdated
| }, [location]) | ||
|
|
||
| return <time dateTime={age.toISOString()}>{diff}</time> | ||
| return <time dateTime={age.toISOString()}>{diff.replace(/^-\s*/, '')}</time> |
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.
Hehe, nice.
I think Math.abs is a better solution.
And this does not look like a fix, because it would just convert negative distance to positive, which is not correct.
|
This seems to be cause by date-fns/date-fns#3238 |
|
Please remove it. |
What does "more" mean? |
It is removed! |
If you look at 'Sly 91X' in the screenshot I added the version in saga (to the right) says Wi-Fi was updated 1h ago, while in this branch is says 3s and it will count up. Same with 'single-cell': 1h VS 2m. I am passing in 'location.ts' to Relativetime so I believe it should only update when location is updated so I'm not sure why we have the differences. |
|
I believe this is just because the left has more recent updates to the geo location. |


closes #92