EvanHahn / HumanizeDuration.js

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

Different value for NULL #144

Closed EmilMoe closed 6 years ago

EmilMoe commented 6 years ago

It would be a great feature, I think, if null would return None or similar in different languages? What do you think? You can still get out 0 by simply using 0.

An example could be:

Time spend on task: None
EvanHahn commented 6 years ago

While potentially useful, this library is in maintenance mode and no new features will be added.

You could solve this with a wrapper function, like so:

function myHumanizer(ms, options) {
  if (ms === null) {
    return 'None'
  } else {
    return humanizeDuration(ms, options)
  }
}

Hope that helps!