Read the statement by Michael Teeuw here.
Calendar showing 12h time format instead of 24h
-
In my calendar module, all entries in the range two days from now are shown with “tomorrow/day after tomorrow at XX:00”, but the time is shown with 12h time format, although in MagicMirror config timeFormat is set to 24.
I presume the reason is a function in calendar.js: in case the day of the event is < currentdate - 2 the event is derived from moment.calendar()
if (event.startDate - now < 2 * oneDay) { // This event is within the next 48 hours (2 days) if (event.startDate - now < this.config.getRelative * oneHour) { // If event is within 6 hour, display 'in xxx' time format or moment.fromNow() timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow()); } else { // Otherwise just say 'Today/Tomorrow at such-n-such time' timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").calendar()); }
E.g., first entry should be “Morgen um 16:30”The moment.calendar() function is used nowhere else in the module.
I haven’t noticed this behaviour before, so I’m not sure if I have triggered this somehow or if it has been there before.
Does anyone have a clue what the problem is?
-
Well I have found the problem.
But it seems to have been resolved with a recent code updateFor those interested:
getLocaleSpecification: function(timeFormat) { switch (timeFormat) { case 12: { return { longDateFormat: {LT: "h:mm A"} }; break; } case 24: { return { longDateFormat: {LT: "HH:mm"} }; break; } default: { return { longDateFormat: {LT: moment.localeData().longDateFormat("LT")} }; break; } } },For case 24 The longDateFormat: hh:mm was wrong. It needs to be HH:mm.
As said, was already changed.
Thanks @MichMich
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login