-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Closed
Description
Environment
SYSTEM: manufacturer: System manufacturer; model: System Product Name; virtual: false
OS: platform: linux; distro: Ubuntu; release: 22.04.5 LTS; arch: x64; kernel: 5.15.0-142-generic
VERSIONS: electron: 36.6.0; used node: 22.15.0; installed node: 22.15.0; npm: 10.9.2; pm2: 6.0.8
OTHER: timeZone: America/Chicago; ELECTRON_ENABLE_GPU: undefined
Which start option are you using?
node --run start
Are you using PM2?
No
Module
calendar
Have you tried disabling other modules?
- Yes
- No
Have you searched if someone else has already reported the issue on the forum or in the issues?
- Yes
What did you do?
{
module: "calendar",
header: "US Holidays",
position: "top_left",
config: {
limitDays:1, // should allow anything on 1 day
calendars: [
{
fetchInterval: 7 * 24 * 60 * 60 * 1000,
symbol: "calendar-check",
url: "https://ics.calendarlabs.com/76/mm3137/US_Holidays.ics"
}
]
}
},
What did you expect to happen?
if there are 4 events on a single day
then the 1st (not past tense) event should be found, the second thru 4th not
later when the time has passed
the second (non past tense) event should be found
What actually happened?
only the 1st event of the day was found
Additional comments
code is comparing date AND TIME, not just date
fix for calendar.js
if (this.config.limitDays > 0) {
let newEvents = [];
let lastDate = today.clone().subtract(1, "days");
let days = 0;
for (const ev of events) {
let eventDate = this.timestampToMoment(ev.startDate).startOf('day'); // add .startOf('day'), note dot, has time in it if not fullday event
if (eventDate.isAfter(lastDate)) { if event 1 is after event 2 on same day, with time, it will be counted as a 'day' difference
lastDate=eventDate
... Participation
- I am willing to submit a pull request for this change.