From d5ef8d19353a453275f0cbe5f1d6faf77fe23493 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Sun, 27 Aug 2023 14:41:24 +1200 Subject: [PATCH] fix icalparser for full-day events --- .config/mutt/icalparser | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) 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()) -- 2.39.2