]> git.madduck.net Git - etc/mutt.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

fix icalparser for full-day events
authormartin f. krafft <madduck@madduck.net>
Sun, 27 Aug 2023 02:41:24 +0000 (14:41 +1200)
committermartin f. krafft <madduck@madduck.net>
Sun, 27 Aug 2023 02:41:24 +0000 (14:41 +1200)
.config/mutt/icalparser

index 50ed4726865ec22c2525918a8fd5796f9df710ce..ee46e6153a211a04a850ee3a80f7c5db3a815062 100755 (executable)
@@ -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())