artisticat1 / gnome-next-up

Show your next calendar event in the status bar

Home Page:https://extensions.gnome.org/extension/5465/next-up/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add option to ignore all day events

nikolowry opened this issue · comments

commented

Please add the ability to ignore all day events. It's confusing when there are holidays and birthdays.

Attached screenshot of the experience on 2023.06.14 which is an American federal holiday named Flag Day

Screenshot from 2023-06-14 09-36-47

Is there any intention of implementation of this feature ?

Maybe see how https://github.com/chmouel/gnome-next-meeting-applet does it ?

Is there any intention of implementation of this feature ?

Maybe see how https://github.com/chmouel/gnome-next-meeting-applet does it ?

function getTodaysEvents(calendarSource) {

    const src = calendarSource;
    src._loadEvents(true);

    const today = new Date();
    today.setHours(0, 0, 0, 0); // Get event from today at midnight

    const tomorrow = new Date(today);
    tomorrow.setDate(today.getDate() + 1);

    let todaysEvents = src.getEvents(today, tomorrow);

    todaysEvents = todaysEvents.filter(event => {
        const start = event.date;
        const end = event.end;
        return !(start.getHours() === 0 && start.getMinutes() === 0 &&
                 end.getHours() === 0 && end.getMinutes() === 0);
    });

    return todaysEvents;
}

Thanks to @coignard, implemented and tested proposed fix in PR #19.

Hope, @artisticat1 will review and accept this.