EvanHahn / HumanizeDuration.js

361000 becomes "6 minutes, 1 second"
https://evanhahn.github.io/HumanizeDuration.js/
The Unlicense
1.65k stars 175 forks source link

I can't get over 2 weeks and 5 days #214

Closed wechselgeld closed 1 year ago

wechselgeld commented 1 year ago

Hey!

When I try to convert the timestamp to a human readable timestamp, it does not work. Everything over two weeks and five days, get's sort of cut off, and it only displays things like "2 weeks, 5 days, 19 hours, 10 minutes, 0.400720999956131".

That's my code:

const expireTimestamp = dayjs().add(6, 'months').valueOf();
const humanTimestamp = humanizeDuration(Math.floor(expireTimestamp / 1000));
EvanHahn commented 1 year ago

It looks like you're dividing by 1000. What happens if you remove that?

wechselgeld commented 1 year ago

It looks like you're dividing by 1000. What happens if you remove that?

Then I get something like "53 years, 8 months, 2 weeks, 22 hours, 49 minutes, 48.25 seconds" out of it.

wechselgeld commented 1 year ago

Nevermind, I am the dumbest person on earth. Thank you for your time.

EvanHahn commented 1 year ago

Nevermind, I am the dumbest person on earth. Thank you for your time.

I'm sure that's not true! Feel free to open a new issue if you encounter any other problems.