Skip to content

Conversation

@ncthanh2000
Copy link

@ncthanh2000 ncthanh2000 commented Aug 28, 2021

One problem with the sort function before writing to csv is that there could be events that happen all day, hence their dtstart and dtend fields do not have time, and only dates. This makes the sorted() function unable to sort by dtstart, as raises the error "cannot compare datetime.datetime to datetime.date".

open_cal() now return the list of events as well as the calendar itself, so that you can get the field calendar.CALENDAR_TIMEZONE. This is used to convert the events that happen all day to a particular time, in a particular timezone. By default, the timezone is the calendar's timezone (determined by the line

This is useful in formatting events that happen for the entire day, as their start and end do not have start fields.

Also implemented format_events() so that all events start and end time are in datetime.datetime format, rather than datetime.date format. This allows sortedevents to run regardless of events are for a specified time or the whole day.

ncthanh2000 and others added 3 commits August 28, 2021 18:29
of events as well as the calendar itself, so that you can get the field
calendar.CALENDAR_TIMEZONE

This is useful in formatting events that happen for the entire day, as
their start and end do not have start fields.

Also implemented format_events so that all events start and end time are
in datetime.datetime format, rather than datetime.date format. This
allows sortedevents to run regardless of events are for a specified time
or the whole day.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant