def get_time_from_str(when):
    """Convert a string to a time: first uses the dateutil parser, falls back
    on fuzzy matching with parsedatetime
    """
    zero_oclock_today = datetime.now(tzlocal()).replace(
        hour=0, minute=0, second=0, microsecond=0
    )

    # Only apply dayfirst=True if date actually starts with "XX-XX-".
    # Other forms like YYYY-MM-DD shouldn't rely on locale by default (#792).
    dayfirst = (
        _is_dayfirst_locale() if re.match(r'^\d{1,2}-\d{1,2}-', when) else None
    )
    try:
        event_time = dateutil_parse(
            when, default=zero_oclock_today, dayfirst=dayfirst
        )
    except ValueError:
        struct, result = fuzzy_date_parse(when)
        if not result:
            raise ValueError('Date and time is invalid: %s' % (when))
        event_time = datetime.fromtimestamp(time.mktime(struct), tzlocal())

    return event_time
Convert a string to a time: first uses the dateutil parser, falls back
    on fuzzy matching with parsedatetime
    
gcalcli/utils.py