diff --git a/calendar/plugin.json b/calendar/plugin.json index 80de5bc..4891070 100644 --- a/calendar/plugin.json +++ b/calendar/plugin.json @@ -2,7 +2,7 @@ "main": "plugin.js", "name": "calendar", "description": "Plugin for iCalendar/VCS room events", - "version": "1.1.0", + "version": "1.1.1", "tags": ["commands", "utility", "calendar"], "dependencies": ["simplecommands"], "npmDependencies": ["node-ical@^0.12.3"] diff --git a/calendar/plugin.ts b/calendar/plugin.ts index e312eb2..dee1e1c 100644 --- a/calendar/plugin.ts +++ b/calendar/plugin.ts @@ -37,6 +37,11 @@ function nts(): number { return Math.floor(Date.now() / 1000); } +function utcNoHours(start: number): Date { + const fts = new Date(start); + return new Date(Date.UTC(fts.getFullYear(), fts.getMonth(), fts.getDate())); +} + function eventsFor(msg: IMessage): Event[] { return memcache.filter((ev: Event) => { if (!msg.fullRoomID) { @@ -146,8 +151,8 @@ async function fetchCalendars(interval: number): Promise { // Recurring events handling if ('rrule' in data) { const rrule = (data as any).rrule as any; - const recurring = rrule.between(new Date(), - new Date(Date.now() + cfg.timeFrame * 1000)); + const recurring = rrule.between(utcNoHours(Date.now()), + utcNoHours(Date.now() + cfg.timeFrame * 1000), true); const originalDuration = end - start; for (const date of recurring) { const newStart = Math.floor(new Date(date).getTime() / 1000); diff --git a/squeebot.repo.json b/squeebot.repo.json index 6bed318..1bf28aa 100644 --- a/squeebot.repo.json +++ b/squeebot.repo.json @@ -3,7 +3,7 @@ "plugins": [ { "name": "calendar", - "version": "1.1.0" + "version": "1.1.1" }, { "name": "debug",