Calender respects timeformat

In reference to issue #776, made changes to calendar.js to respect timeformat config option if it is used
This commit is contained in:
Unknown
2017-06-26 13:03:03 +02:00
parent 51494cabc8
commit 3404ebbbb8
2 changed files with 24 additions and 0 deletions

View File

@@ -69,6 +69,29 @@ Module.register("calendar", {
// Set locale.
moment.locale(config.language);
switch (config.timeFormat) {
case 12: {
moment.updateLocale(config.language, {
longDateFormat: {
LT: "h:mm A"
}
});
break;
}
case 24: {
moment.updateLocale(config.language, {
longDateFormat: {
LT: "hh:mm"
}
});
break;
}
// If config.timeFormat was not given (or has invalid format) default to locale default
default: {
break;
}
}
for (var c in this.config.calendars) {
var calendar = this.config.calendars[c];
calendar.url = calendar.url.replace("webcal://", "http://");