hustcc / timeago.js

:clock8: :hourglass: timeago.js is a tiny(2.0 kb) library used to format date with `*** time ago` statement.
https://timeago.org
MIT License
5.29k stars 411 forks source link

Incorect use of Math.floor() #222

Open kaliopane opened 4 years ago

kaliopane commented 4 years ago

Here you're using this function for something that needs to be Math.round(). Currently, if you've marked a event with a UTC int timestamp, let's say x, and convert the number to hours based on specific event time y in the future, you will not get correct results. 50 minutes past the first event having x value, will not be counted as an hour. Thus, this creates a bug.

hour 0 ----> hour 0 + 35 min - this will not show 'after 1 hour'

If you change the function to Math.round() everything is fixed.

kaliopane commented 3 years ago

Any update on that?

kaliopane commented 3 years ago

Is that library even maintained?

lolobosse commented 3 years ago

If I were you, I would create a PR and see if it passes the tests :smile: