EvanHahn / HumanizeDuration.js

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

Ability to control language settings in options. #29

Closed darknos closed 9 years ago

darknos commented 10 years ago

Could you look at this commit for details:

https://github.com/darknos/HumanizeDuration.js/commit/8eaa252c05ac82df164141d8aec23c7237887d09

One line of code change and you can control language without code modifications.

EvanHahn commented 9 years ago

You can do what you've proposed pretty easily:

var humanizer = humanizeDuration.humanizer({
  language: "newLanguage",
  languages: {
    newLanguage: {
      year: function(c) { return c + "yrs"; },
      month: function(c) { return c + "mos"; },
      // ...
    }
  }
});

Sorry it took so long to get back to you!