Make date sortable
vpoulailleau opened this issue · comments
I tried to merge events from two calendars retrieved with https://github.com/kuzmoyev/google-calendar-simple-api like this:
events = list(feries[1 / Nov / 2020 : 30 / Nov / 2020])
events.extend(cours[1 / Nov / 2020 : 30 / Nov / 2020])
for event in sorted(events):
sorted
fails. This may be solved with https://docs.python.org/3/library/functools.html#functools.total_ordering
What do you think about this idea?
The BeautifulDate
s are sortable as they are directly inherited from date
.
The problem is that Event
s in gcsa
are not sortable. So it should be an issue in https://github.com/kuzmoyev/google-calendar-simple-api. I'll move it there in a free time. Or you can do that.
Thank you for the issue submission.
So for now
for event in sorted(events, key=lambda e: e.start):
should do.
And I like the functools.total_ordering
idea!