Closed jsejcksn closed 8 years ago
You can do this by creating a humanizer with a new language, like so:
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' },
}
}
})
shortEnglishHumanizer(15600000) // '4 h, 20 m'
Does that help?
@EvanHahn Definitely! Sorry, I clearly missed that part of the documentation when I skimmed it. Should have read more thoroughly before posting. Thanks.
No worries!
This library is so excellent! After seeing that Moment.js did not support granular display, I was very glad to see this.
I am wondering if it wouldn't be too difficult to implement abbreviated units of time. For example:
(I'm sure there's a standard for this somewhere).
The reason why I'm asking is because I'm using this library for sending push notifications and it would save a lot of space if abbreviations could be used.