X-Git-Url: https://git.madduck.net/etc/mutt.git/blobdiff_plain/7c5b26c61ffd9a6ec42edf94fa09259ac501b4ee..d5ef8d19353a453275f0cbe5f1d6faf77fe23493:/.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())