X-Git-Url: https://git.madduck.net/etc/mutt.git/blobdiff_plain/7013dfe93a05082153f79eca6c9e5c05b54d9d50..refs/heads/master:/.config/mutt/icalparser diff --git a/.config/mutt/icalparser b/.config/mutt/icalparser index 50ed472..ee46e61 100755 --- a/.config/mutt/icalparser +++ b/.config/mutt/icalparser @@ -25,19 +25,24 @@ def dtstrs(event): return dt.astimezone().strftime(strf) ret = [] - if start.tzinfo == end.tzinfo: - ret.append(strftime(start, '%F %R')) - else: - ret.append(strftime(start, '%F %R %Z')) + try: + if start.tzinfo == end.tzinfo: + ret.append(strftime(start, '%F %R')) - if start.date() == end.date(): - ret.append(strftime(end, '%T %Z')) + else: + ret.append(strftime(start, '%F %R %Z')) - else: - ret.append(strftime(end, '%F %R %Z')) + if start.date() == end.date(): + ret.append(strftime(end, '%T %Z')) + + else: + ret.append(strftime(end, '%F %R %Z')) + + return ret - return ret + except AttributeError: + return map(lambda d: d.strftime('%F'), (start, end)) def parse_ics_file(fp): cal = Calendar.from_ical(fp.read())