From a5c36d7acb530ee5b1a7d2b1f7fe5c6ff10cb9d0 Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Fri, 8 Nov 2024 21:42:33 +0100 Subject: [PATCH] Import parse util --- personal_data/parse_util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/personal_data/parse_util.py b/personal_data/parse_util.py index be3bd3f..50f1128 100644 --- a/personal_data/parse_util.py +++ b/personal_data/parse_util.py @@ -22,7 +22,7 @@ FORMAT_DATE_HEADER = '%a, %d %b %Y %H:%M:%S GMT' def parse_duration(text: str) -> datetime.timedelta: (num_str, unit_str) = text.split(' ') - num = int(num_str) + num = float(num_str) unit = DATETIME_UNITS[unit_str] return unit * num @@ -78,5 +78,7 @@ def parse_date(text: str) -> datetime.date: return dt.date() if dt := try_parse(text, '%B %d, %Y'): return dt.date() + if dt := try_parse(text, '%b %d'): + return dt.date() msg = 'Unknown format: ' + text raise RuntimeError(msg)