Closed ipeshev closed 8 years ago
I just tried running this code and it worked for me:
var humanizeDuration = require('./')
var shortEnglishHumanizer = humanizeDuration.humanizer({
language: 'shortEn',
languages: {
shortEn: {
y: function() { return 'y' },
mo: function() { return 'mo' },
w: function() { return 'w' },
d: function() { return 'd' },
h: function() { return 'h' },
m: function() { return 'm' },
s: function() { return 's' },
ms: function() { return 'ms' },
}
}
})
console.log(shortEnglishHumanizer(15600000))
Are you perhaps using an old version of the library?
Yes this should be the reason
The example for adding new language is not working ... shortEn: { y: function() { return 'y' }, mo: function() { return 'mo' }, w: function() { return 'w' }, d: function() { return 'd' }, h: function() { return 'h' }, m: function() { return 'm' }, s: function() { return 's' }, ms: function() { return 'ms' }, } ... when looking at the code it appears that , this should be written like this. shortEn: { year: function() { return 'y' }, month: function() { return 'mo' }, week: function() { return 'w' }, day: function() { return 'd' }, hour: function() { return 'h' }, minute: function() { return 'm' }, second: function() { return 's' }, millisecond: function() { return 'ms' }, }