ngryman / reading-time

:books: Medium's like reading time estimation.
https://ngryman.sh
MIT License
1.37k stars 46 forks source link

Math.round Minutes by default #55

Closed surjithctly closed 1 year ago

surjithctly commented 1 year ago

Currently the minutes returns 5.87 or 6.43 like this.

But nobody wanted to read like that. I checked the source and it seems the round is added, but it's not working.

Could be a bug?

Here's a minimal reproduction: https://stackblitz.com/edit/node-nyf9tn?file=index.js

Run node index to see the result.

DerTimonius commented 1 year ago

I'd love to take a look into this issue 🙂

Josh-Cena commented 1 year ago

Hi @surjithctly you are using 1.5.0. In v1, minutes is the raw time without any rounding. You need to use displayed to get the rounded behavior. In v2 (currently 2.0.0-1), we no longer have the raw minutes, and minutes is rounded by default, so you should try it out.