mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
* Worked around several issues in the RRULE library that were causing deleted calender events to still show, some initial and recurring events to not show, and some event times to be off an hour. (#3291) * Renamed variables in *calendarfetcherutils.js* to be more clear about use of `moment` and js's `Date` class. * Added calendar config option `forceUseCurrentTime` (default:`false`) which will ignore overridden `Date.now` in the config in order to keep some tests consistent. * Added several unit tests for crossing DST in different timezones with excluded events.
This commit is contained in:
@@ -36,6 +36,7 @@ Module.register("calendar", {
|
||||
hideDuplicates: true,
|
||||
showTimeToday: false,
|
||||
colored: false,
|
||||
forceUseCurrentTime: false,
|
||||
tableClass: "small",
|
||||
calendars: [
|
||||
{
|
||||
@@ -567,9 +568,16 @@ Module.register("calendar", {
|
||||
const ONE_HOUR = ONE_MINUTE * 60;
|
||||
const ONE_DAY = ONE_HOUR * 24;
|
||||
|
||||
const now = new Date();
|
||||
const today = moment().startOf("day");
|
||||
const future = moment().startOf("day").add(this.config.maximumNumberOfDays, "days").toDate();
|
||||
let now, today, future;
|
||||
if (this.config.forceUseCurrentTime || this.defaults.forceUseCurrentTime) {
|
||||
now = new Date();
|
||||
today = moment().startOf("day");
|
||||
future = moment().startOf("day").add(this.config.maximumNumberOfDays, "days").toDate();
|
||||
} else {
|
||||
now = new Date(Date.now()); // Can use overridden time
|
||||
today = moment(now).startOf("day");
|
||||
future = moment(now).startOf("day").add(this.config.maximumNumberOfDays, "days").toDate();
|
||||
}
|
||||
let events = [];
|
||||
|
||||
for (const calendarUrl in this.calendarData) {
|
||||
|
Reference in New Issue
Block a user