From f44738b837444de1d877a00bc2c3de175af545bf Mon Sep 17 00:00:00 2001 From: SidestreamColdMelon Date: Wed, 6 Dec 2023 16:57:14 +0100 Subject: [PATCH] accept any iso date as input --- scripts/time.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/time.py b/scripts/time.py index 53c2990c8..83993c54b 100755 --- a/scripts/time.py +++ b/scripts/time.py @@ -12,12 +12,12 @@ parsed=parser.parse_args() # Cleanup positional arguments -date = parsed.date.replace("date=", "").replace(" UTC", "") +date = parsed.date.replace("date=", "").upper().replace(" UTC", "") stamp = parsed.stamp.replace("stamp=", "") # Convert provided input in UTC format into desired output in UTC as well if date: - utc_date = datetime.strptime(date, DATE_FORMAT).replace(tzinfo=timezone.utc) + utc_date = datetime.fromisoformat(date).replace(tzinfo=timezone.utc) print(utc_date) print(int(utc_date.timestamp())) if stamp: