Skip to content

Conversation

@Lenakh97
Copy link
Contributor

closes #92

@Lenakh97
Copy link
Contributor Author

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.

@Lenakh97 Lenakh97 requested a review from coderbyheart October 14, 2025 13:39
}, [location])

return <time dateTime={age.toISOString()}>{diff}</time>
return <time dateTime={age.toISOString()}>{diff.replace(/^-\s*/, '')}</time>
Copy link
Member

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.

@coderbyheart
Copy link
Member

This seems to be cause by date-fns/date-fns#3238

@coderbyheart
Copy link
Member

coderbyheart commented Oct 14, 2025

  • Remove GeoLocationAge and use RelativeTime instead
  • Remove all usages of intlFormatDistance() from the code base and use formatDistance() from RelativeTime

@Lenakh97
Copy link
Contributor Author

I removed GeoLocationAge and used RelativeTime instead. intlFormatDistance was only used once in this repo. The change I see is that we loose the 'ago' behind the time. We are also missing the 'yesterday' text and getting '16h' for example.

I can also see that the location time changes more in this version than in saga right now. Do we have any rules on when they should be updated?

Attaching a photo of localhost in this branch VS world.thingy.rocks:
Screenshot 2025-10-16 at 15 21 05

@Lenakh97 Lenakh97 requested a review from coderbyheart October 16, 2025 13:23
@coderbyheart
Copy link
Member

intlFormatDistance was only used once in this repo.

Please remove it.

@coderbyheart
Copy link
Member

I can also see that the location time changes more in this version than in saga right now. Do we have any rules on when they should be updated?

What does "more" mean?

@Lenakh97
Copy link
Contributor Author

intlFormatDistance was only used once in this repo.

Please remove it.

It is removed!

@Lenakh97
Copy link
Contributor Author

I can also see that the location time changes more in this version than in saga right now. Do we have any rules on when they should be updated?

What does "more" mean?

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.

@coderbyheart
Copy link
Member

I believe this is just because the left has more recent updates to the geo location.

@coderbyheart
Copy link
Member

I've changed the unit of the time to be distinguishable now from distance.

image

@coderbyheart coderbyheart merged commit 5d46bc3 into saga Oct 17, 2025
2 checks passed
@coderbyheart coderbyheart deleted the location-time-diff branch October 17, 2025 06:33
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.

Location time is sometimes negative

3 participants