summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Brox <tobias@redpill-linpro.com>2020-12-25 22:12:32 +0100
committerTobias Brox <tobias@redpill-linpro.com>2020-12-25 22:12:32 +0100
commit5d3e9f451b0ab29112111d64a0de8a44d1b59b2d (patch)
tree1e73341c354e531eb74b2b0b8306b5b978bf41ce
parentf67fa8be1f55f6db015e5e9bb478ae939deb57c6 (diff)
downloadcalendar-cli-5d3e9f451b0ab29112111d64a0de8a44d1b59b2d.zip
resolves https://github.com/tobixen/calendar-cli/issues/80
-rwxr-xr-xcalendar-cli.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/calendar-cli.py b/calendar-cli.py
index c7b0edb..ec9adaa 100755
--- a/calendar-cli.py
+++ b/calendar-cli.py
@@ -497,7 +497,10 @@ def calendar_agenda(caldav_conn, args):
if not isinstance(dtstart, datetime):
dtstart = datetime(dtstart.year, dtstart.month, dtstart.day)
if not dtstart.tzinfo:
- dtstart = tzinfo.localize(dtstart)
+ try:
+ dtstart = tzinfo.localize(dtstart)
+ except AttributeError:
+ dtstart.astimezone(tzinfo)
## convert into timezone given in args:
dtstart = dtstart.astimezone(_tz(args.timezone))
events.append({'dtstart': dtstart, 'instance': event})