diff --git a/CHANGELOG.md b/CHANGELOG.md index 999048d4..1bb7d4bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ _This release is scheduled to be released on 2023-04-01._ - Use develop as target branch for dependabot - Update issue template and contributing doc +- Update dates in Calendar widgets every minute ### Fixed diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 15da1d5d..762d4b9d 100644 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -86,6 +86,8 @@ Module.register("calendar", { // Override start method. start: function () { + const ONE_MINUTE = 60 * 1000; + Log.info("Starting module: " + this.name); // Set locale. @@ -131,6 +133,14 @@ Module.register("calendar", { // fetcher till cycle this.addCalendar(calendar.url, calendar.auth, calendarConfig); }); + + // Refresh the DOM every minute if needed: When using relative date format for events that start + // or end in less than an hour, the date shows minute granularity and we want to keep that accurate. + setTimeout(() => { + setInterval(() => { + this.updateDom(1); + }, ONE_MINUTE); + }, ONE_MINUTE - (new Date() % ONE_MINUTE)); }, // Override socket notification handler.