You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be possible (and appropriate) for this library to convert to hybrid units where the whole number is the first unit and any remainder is the 2nd?
Hi @mkaatman! Apologies for the horribly late response, I must have accidentally dismissed the notification 😞
Regarding your question, I think that could be a really neat feature to add to this library. There's some prior art for this in the moment.js library which has a method named humanize for doing pretty much exactly this except with durations of time.
It would be difficult to implement the interface as you suggested in the comment without resorting to some JavaScript trickery (since inches is just a number, not an object). We could do something like unit.humanize(inches, 'ft-in').
If you're willing to start off an implementation, we'd be more than happy to help design and review
Would it be possible (and appropriate) for this library to convert to hybrid units where the whole number is the first unit and any remainder is the 2nd?
Something like:
const inches = unit(18, 'inches');
const footInches = inches.displayAs('ft-in', " - "); // "1 ft - 6 in"
Or is that use case better handled outside of this library?
The text was updated successfully, but these errors were encountered: