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 timeago #469

Closed
wants to merge 1 commit into from
Closed

Fix timeago #469

wants to merge 1 commit into from

Conversation

robertvanhoesel
Copy link
Contributor

I noticed on posts from between 45-60 minutes ago the time was rounded to 0h instead of 1h. This config change fixes that, but maybe it is worth checking if there's an issue with https://vueuse.org/core/usetimeago/ @antfu

CleanShot 2022-12-20 at 02 08 36@2x

@robertvanhoesel robertvanhoesel added the c: bug Something isn't working label Dec 20, 2022
@netlify
Copy link

netlify bot commented Dec 20, 2022

Deploy Preview for elk-zone ready!

Name Link
🔨 Latest commit 96278f6
🔍 Latest deploy log https://app.netlify.com/sites/elk-zone/deploys/63a10c85db076e0008b61eb1
😎 Deploy Preview https://deploy-preview-469--elk-zone.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@stackblitz
Copy link

stackblitz bot commented Dec 20, 2022

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@robertvanhoesel
Copy link
Contributor Author

cc @userquin related to #444 #145

@patak-dev
Copy link
Member

Thanks! I think we better fix this on useTimeAgo. Let's take the opportunity of the alpha to push us to fix things upstream.

@userquin
Copy link
Member

cc @userquin related to #444 #145

Why is using hours? It should use minutes, maybe DEFAULT_UNITS in useTimeAgo is wrong (max value), hours should be used when abs(diff) > 60min, I'll try to do some tests this afternoon

@userquin
Copy link
Member

userquin commented Dec 20, 2022

The max value for minutes is 46min: 2760000 / 60000 = 46, that's why using hours and floor results in 0h.

@userquin
Copy link
Member

We need to fix this on useTimeAgo, maybe providing custom ranges or custom calculation callback: DEFAULT_UNITS contains implicit rounding logic

@userquin
Copy link
Member

Right now the issue will be present, we cannot fix original issue and minute ranges in this issue at the same time without changing useTimeAgo.

@antfu
Copy link
Member

antfu commented Dec 20, 2022

Working on it

@antfu
Copy link
Member

antfu commented Dec 20, 2022

Fix: vueuse/vueuse@f40a021
Pending for next release

@robertvanhoesel robertvanhoesel added c: dependencies Pull requests that adds/updates a dependency do NOT merge yet Do not merge this PR into the target branch yet labels Dec 20, 2022
@antfu antfu closed this in 602afa4 Dec 20, 2022
@KaKi87 KaKi87 deleted the robertvanhoesel/patch-89837 branch January 4, 2023 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: bug Something isn't working c: dependencies Pull requests that adds/updates a dependency do NOT merge yet Do not merge this PR into the target branch yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants