Cleaned up time formatting

This commit is contained in:
Mark McDowall
2014-08-05 07:30:44 -07:00
parent 0a8dcaaf16
commit b0c45aef50
4 changed files with 13 additions and 10 deletions

View File

@@ -45,7 +45,7 @@ define(
return date.fromNow();
},
pad: function(n, width, z) {
pad: function (n, width, z) {
z = z || '0';
n = n + '';
return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;

View File

@@ -9,11 +9,19 @@ define(
url : window.NzbDrone.ApiRoot + '/config/ui',
shortDateTime : function () {
return this.get('shortDateFormat') + ' ' + this.get('timeFormat').replace('(', '').replace(')', '');
return this.get('shortDateFormat') + ' ' + this.time(true);
},
longDateTime : function () {
return this.get('longDateFormat') + ' ' + this.get('timeFormat').replace('(', '').replace(')', '');
return this.get('longDateFormat') + ' ' + this.time(true);
},
time : function (includeMinuteZero) {
if (includeMinuteZero) {
return this.get('timeFormat').replace('(', '').replace(')', '');
}
return this.get('timeFormat').replace(/\(\:mm\)/, '');
}
});