aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2024-05-12 21:17:10 +0200
committerlonkaars <loek@pipeframe.xyz>2024-05-12 21:17:10 +0200
commit8a11bd68d9220ca4789f98664bb4e2a564705dd2 (patch)
treebe122c0d9563dc23408518fb6a6c2c0e6046f437
parentffb2ff33b5ccf9f4391975ef770097753ebbfe53 (diff)
actually handle timezones correctly this timeHEADmaster
-rwxr-xr-xautoplanner.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/autoplanner.py b/autoplanner.py
index 4439146..439cd2c 100755
--- a/autoplanner.py
+++ b/autoplanner.py
@@ -36,7 +36,7 @@ def read_file(filename):
def get_trip(date):
# data = ""
- # with open("./res.json", "r") as gert:
+ # with open("./autoplanner-api-response.json", "r") as gert:
# data = gert.read()
# gert.close()
# return data
@@ -114,7 +114,6 @@ def main():
# this is garbage code, but gets a list containing the date/time for each
# first event of every day after today
times = [event.get('dtstart').dt for event in events] # get datetimes of all event *start* times
- times = [tz.localize(dt.replace(tzinfo=None)) for dt in times] # offset times by timezone from input calendar
times = [x.timestamp() for x in times] # convert to epoch timestamps
times = [(x // DAY, x % DAY) for x in times] # split into days and seconds
times = [x for x in times if x[1] == min([y[1] for y in times if y[0] == x[0]])] # only leave smallest seconds in day