Skip to content
This repository was archived by the owner on Feb 6, 2019. It is now read-only.
This repository was archived by the owner on Feb 6, 2019. It is now read-only.

Deal with all day events #12

@fp9695253

Description

@fp9695253

Calendar does not currently deal with all-day events, problem is with datetime parser step.

Exception looks like this:

ERROR:root:XXX Failed to convert event to JSON
Traceback (most recent call last):
  File "/home/ubuntu/calendars/scripts/util_gcal.py", line 226, in update_gcal_from_components_map
    ical_event = ics2gcal_event(ical_events[eid])
  File "/home/ubuntu/calendars/scripts/util_gcal.py", line 661, in ics2gcal_event
    startdt = utc.localize(datetime.datetime.strptime(vevent_decode(vevent['DTSTART']), "%Y%m%dT%H%M%SZ"))
  File "/home/ubuntu/.pyenv/versions/miniconda3-4.3.30/lib/python3.6/_strptime.py", line 565, in _strptime_datetime
    tt, fraction = _strptime(data_string, format)
  File "/home/ubuntu/.pyenv/versions/miniconda3-4.3.30/lib/python3.6/_strptime.py", line 362, in _strptime
    (data_string, format))
ValueError: time data '20180530' does not match format '%Y%m%dT%H%M%SZ'

Fix this with the following:

try:
    # parse as YYYY-MM-DD HH:MM:SS
except 
    try:
        # parse as YY-MM-DD
    except:
        # now raise the exception and pass it on

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions