Handle all day events #15
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.