Merge pull request #926 from QNimbus/calendar-timeformat-pr

Calender respects timeformat
This commit is contained in:
Michael Teeuw 2017-06-29 09:26:26 +02:00 committed by GitHub
commit 223cf4b2b2
2 changed files with 24 additions and 0 deletions

View File

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

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://");