From 120f0299b2a7fc08100a393f9338bf13bf591ba5 Mon Sep 17 00:00:00 2001 From: TheDuffman85 Date: Tue, 9 Feb 2021 16:05:38 +0100 Subject: [PATCH 1/2] Added a new parameter to hide time portion on relative times Added a new parameter hideTime with default value false. This parameter hides the time portion on relative times. --- modules/default/calendar/calendar.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index d5f5250b..05e50efe 100755 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -36,6 +36,7 @@ Module.register("calendar", { fadePoint: 0.25, // Start on 1/4th of the list. hidePrivate: false, hideOngoing: false, + hideTime: false, colored: false, coloredSymbolOnly: false, customEvents: [], // Array of {keyword: "", symbol: "", color: ""} where Keyword is a regexp and symbol/color are to be applied for matched @@ -366,7 +367,17 @@ Module.register("calendar", { // Show relative times if (event.startDate >= now) { // Use relative time - timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").calendar()); + if (!this.config.hideTime) { + timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").calendar()); + } else { + timeWrapper.innerHTML = this.capFirst( + moment(event.startDate, "x").calendar(null, { + sameDay: "[Today]", + nextDay: "[Tomorrow]", + nextWeek: "dddd" + }) + ); + } if (event.startDate - now < this.config.getRelative * oneHour) { // If event is within getRelative hours, display 'in xxx' time format or moment.fromNow() timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow()); From 57dc3496756992e0b8c97a2a31f3d1eaa9865f53 Mon Sep 17 00:00:00 2001 From: TheDuffman85 Date: Tue, 9 Feb 2021 16:06:21 +0100 Subject: [PATCH 2/2] Added a new parameter to hide time portion on relative times --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7faa4f48..1c45d8ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ _This release is scheduled to be released on 2021-04-01._ - Added logging when using deprecated modules weatherforecast or currentweather. - Portuguese translations for "MODULE_CONFIG_CHANGED" and PRECIP. - Respect parameter ColoredSymbolOnly also for custom events +- Added a new parameter to hide time portion on relative times ### Updated