sindresorhus / pretty-ms

Convert milliseconds to a human readable string: `1337000000` → `15d 11h 23m 20s`
MIT License
1.08k stars 65 forks source link

Suggestions: add microseconds, localisation and ranges #57

Closed nedkamburov closed 2 years ago

nedkamburov commented 2 years ago

Hello there, I have been working on a component like this for some time now and can add a few features if there is an interest. Let's discuss them and let me know if you think they should be implemented.

  1. Milliseconds is great but if needed should there an option to parse smaller time increments too? Micro-, pico- seconds too?
  2. Localisation for the day, minutes, hours, etc. can be easily integrated and perhaps it will come in handy. For staters, we can add 10-15 languages only. Additionally, there could be different formatting of those expanded strings once you choose a specific language.
  3. A range string poses some interesting problems but fortunately it's not to hard to implement something like (1h 2m - 1h 25m or 1000 - 1200ms)
sindresorhus commented 2 years ago

Thanks for reaching out. Those are good ideas, but I would prefer to keep the scope of this package limited to the current core functionality. I'm also not interested in managing localizations. So I recommend making your own package for these things. I'm happy to link to it in the readme.

nedkamburov commented 2 years ago

Alright, no worries, it was good discussing it anyways. Thank you for the suggestion!