Skip to content

Commit

Permalink
FIX: humanizer units format according to humanize-duration v3.1.0+
Browse files Browse the repository at this point in the history
Removed moment.locale setting to prevent unwanted side effects on users moment.locale settings.
  • Loading branch information
simonemazzoni committed Mar 8, 2017
1 parent a704c4e commit ad3c984
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions app/js/i18nService.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ app.factory('I18nService', function() {
this.language = this.fallback;
}

//moment init
moment.locale(this.language); // @TODO maybe to remove, it should be handle by the user's application itself, and not inside the directive
// It should be handle by the user's application itself, and not inside the directive
// moment init
// moment.locale(this.language);

//human duration init, using it because momentjs does not allow accurate time (
// momentJS: a few moment ago, human duration : 4 seconds ago
Expand All @@ -44,13 +45,13 @@ app.factory('I18nService', function() {

if (typeof this.timeHumanizer != 'undefined'){
time = {
'millis' : this.timeHumanizer(diffFromAlarm, { units: ["milliseconds"] }),
'seconds' : this.timeHumanizer(diffFromAlarm, { units: ["seconds"] }),
'minutes' : this.timeHumanizer(diffFromAlarm, { units: ["minutes", "seconds"] }) ,
'hours' : this.timeHumanizer(diffFromAlarm, { units: ["hours", "minutes", "seconds"] }) ,
'days' : this.timeHumanizer(diffFromAlarm, { units: ["days", "hours", "minutes", "seconds"] }) ,
'months' : this.timeHumanizer(diffFromAlarm, { units: ["months", "days", "hours", "minutes", "seconds"] }) ,
'years' : this.timeHumanizer(diffFromAlarm, { units: ["years", "months", "days", "hours", "minutes", "seconds"] })
'millis' : this.timeHumanizer(diffFromAlarm, { units: ["ms"] }),
'seconds' : this.timeHumanizer(diffFromAlarm, { units: ["s"] }),
'minutes' : this.timeHumanizer(diffFromAlarm, { units: ["m", "s"] }) ,
'hours' : this.timeHumanizer(diffFromAlarm, { units: ["h", "m", "s"] }) ,
'days' : this.timeHumanizer(diffFromAlarm, { units: ["d", "h", "m", "s"] }) ,
'months' : this.timeHumanizer(diffFromAlarm, { units: ["mo", "d", "h", "m", "s"] }) ,
'years' : this.timeHumanizer(diffFromAlarm, { units: ["y", "mo", "d", "h", "m", "s"] })
};
}
else {
Expand Down

0 comments on commit ad3c984

Please sign in to comment.