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

@ -37,6 +37,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Fix double message about port when server is starting - Fix double message about port when server is starting
- Corrected Swedish translations for TODAY/TOMORROW/DAYAFTERTOMORROW. - Corrected Swedish translations for TODAY/TOMORROW/DAYAFTERTOMORROW.
- Removed unused import from js/electron.js - Removed unused import from js/electron.js
- Made calendar.js respect config.timeFormat irrespecive of locale setting
## [2.1.1] - 2017-04-01 ## [2.1.1] - 2017-04-01

View File

@ -69,6 +69,29 @@ Module.register("calendar", {
// Set locale. // Set locale.
moment.locale(config.language); 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) { for (var c in this.config.calendars) {
var calendar = this.config.calendars[c]; var calendar = this.config.calendars[c];
calendar.url = calendar.url.replace("webcal://", "http://"); calendar.url = calendar.url.replace("webcal://", "http://");