calendar-cli icon indicating copy to clipboard operation
calendar-cli copied to clipboard

All day events sometimes show on wrong day

Open klundry opened this issue 3 years ago • 4 comments

I have some all day events on a calendar and I'm running this command.

calendar-cli --calendar-url $URL calendar agenda --agenda-days 1

If I run this command on the day before an all day event the all day event gets listed.

klundry avatar Feb 28 '21 15:02 klundry

It may be a timezone issue. The caldav date search cannot be done with dates, it requires a timestamp in UTC if I remember correct, so it's very difficult to get this completely right unless living on Iceland and only having Icelandic events on the calendar.

I'm not going to spend more efforts on this now, but I would happily accept a pull/merge-request :-)

tobixen avatar Feb 28 '21 15:02 tobixen

Fair enough. I think that is probably the issue. Explicitly specifiying the date for the current day seems to avoid the issue in this case. I think I have seen it display on the wrong date in the case of an event in the future as well. Will look into it some more when I see it happen again. Thanks.

klundry avatar Feb 28 '21 16:02 klundry

Ah ... then it's not a timezone issue. Actually, the code looks like this:

    elif args.agenda_days:
        dtend = dtstart + timedelta(args.agenda_days)

and dtstart is by default set to "now".

Hence, when choosing "7 days" (for a week) at a Monday afternoon, it will include all events for the full week plus all events prior to afternoon next Monday. That will also include all whole-day events for Monday.

I don't have the time/resources/mood to make any proper fix for this anytime soon, but I realize it can be considered a "bug".

tobixen avatar Feb 28 '21 17:02 tobixen

Ok. I will see if I can figure out a workaround for now. I'm not a programmer so I wouldn't really now where to start to modify this.

Thanks for the project though. It's working great for my scripts otherwise.

klundry avatar Feb 28 '21 17:02 klundry