<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Calendar showing 12h time format instead of 24h]]></title><description><![CDATA[<p dir="auto">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.</p>
<p dir="auto">I presume the reason is a function in calendar.js: in case the day of the event is &lt; currentdate - 2 the event is derived from moment.calendar()</p>
<pre><code>if (event.startDate - now &lt; 2 * oneDay) {
	// This event is within the next 48 hours (2 days)
	if (event.startDate - now &lt; 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());
	}
</code></pre>
<p dir="auto"><img src="/assets/uploads/files/1541361643386-17412b76-328a-4c7f-bfb9-0fd3ef744245-image.png" alt="0_1541361649708_17412b76-328a-4c7f-bfb9-0fd3ef744245-image.png" class=" img-fluid img-markdown" /><br />
E.g., first entry should be “Morgen um 16:30”</p>
<p dir="auto">The moment.calendar() function is used nowhere else in the module.</p>
<p dir="auto">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.</p>
<p dir="auto">Does anyone have a clue what the problem is?</p>
]]></description><link>https://forum.magicmirror.builders/topic/9034/calendar-showing-12h-time-format-instead-of-24h</link><generator>RSS for Node</generator><lastBuildDate>Wed, 13 May 2026 22:36:46 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/9034.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 04 Nov 2018 20:02:29 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Calendar showing 12h time format instead of 24h on Wed, 07 Nov 2018 13:27:42 GMT]]></title><description><![CDATA[<p dir="auto">Well I have found the problem.<br />
But it seems to have been resolved with a recent code update</p>
<p dir="auto">For those interested:</p>
<pre><code>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;
		}
		}
	},
</code></pre>
<p dir="auto">For case 24 The longDateFormat: hh:mm was wrong. It needs to be HH:mm.<br />
As said, was already changed.<br />
Thanks <a class="plugin-mentions-user plugin-mentions-a" href="/user/michmich" aria-label="Profile: MichMich">@<bdi>MichMich</bdi></a></p>
]]></description><link>https://forum.magicmirror.builders/post/46461</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/46461</guid><dc:creator><![CDATA[lavolp3]]></dc:creator><pubDate>Wed, 07 Nov 2018 13:27:42 GMT</pubDate></item></channel></rss>