Fixed: Use 24 hour time when configured

This commit is contained in:
Mark McDowall 2014-12-26 13:09:43 -08:00
parent 85f7195d57
commit 158e20bfe7
4 changed files with 13 additions and 9 deletions

View File

@ -61,7 +61,7 @@ define(
return '';
}
return moment(input).format(UiSettings.time(false));
return moment(input).format(UiSettings.time(false, false));
});
Handlebars.registerHelper('LTS', function (input) {
@ -69,7 +69,7 @@ define(
return '';
}
return moment(input).format('h:mm:ss A');
return moment(input).format(UiSettings.time(true, true));
});
Handlebars.registerHelper('if_today', function(context, options) {

View File

@ -13,7 +13,7 @@ define(
var age = this.model.get('age');
var ageHours = this.model.get('ageHours');
var published = moment(this.model.get('publishDate'));
var publishedFormatted = published.format('{0} h:mm:ss A'.format(UiSettings.get('shortDateFormat')));
var publishedFormatted = published.format('{0} {1}'.format(UiSettings.get('shortDateFormat'), UiSettings.time(true, true)));
var formatted = age;
var suffix = this.plural(age, 'day');

View File

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

View File

@ -12,7 +12,7 @@ define(
render: function () {
var date = moment(this._getValue());
this.$el.html('<span title="{1}">{0}</span>'.format(date.format(UiSettings.time(true)), date.format(UiSettings.longDateTime())));
this.$el.html('<span title="{1}">{0}</span>'.format(date.format(UiSettings.time(true, false)), date.format(UiSettings.longDateTime(true))));
return this;
}