Open rocketraman opened 5 months ago
@jacobras What is your policy on backwards compatibility at this stage of the project? I could potentially spend some time on submitting one or more PRs for this issue, but would need to understand the parameters of the work.
I try to not introduce breaking changes :) Adding more precise output would be interesting, as long as it's fully localized.
Thanks for the suggestions! I'll take a look at it after #47 is fixed (as that's more important now). A configurable precision has been on my ideas list for a while. Approximity not yet, but it's interesting.
I'll get back to this.
Great library. I have a mini-lib that does the same thing, and I would love to migrate to Human-Readable, but my mini-lib seems to have a couple features I need that it appears Human-Readable does not. It supports (optional) approximation words and customizable precision. So for example, a duration from
2024-03-19T19:55:18.994Z to 2024-03-19T19:58:26994Z
could output:
"about 3 minutes"
and a negative duration of the same length would output:
"about 3 minutes ago"
It also supports multiple units in some cases where that makes sense. For example, a duration from 2024-03-20T20:14:13.536Z to 2024-03-21T22:14:14.536Z would output:
"about 1 day, 2 hours"
Here are some of my unit tests in my mini-lib for reference:
and my implementation looks like this:
Note that the precision is also customizable.