Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,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

Expand Down
10 changes: 10 additions & 0 deletions modules/default/calendar/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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(() => {
Comment thread
rejas marked this conversation as resolved.
setInterval(() => {
this.updateDom(1);
}, ONE_MINUTE);
}, ONE_MINUTE - (new Date() % ONE_MINUTE));
},

// Override socket notification handler.
Expand Down