summaryrefslogtreecommitdiff
path: root/jimbrella
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@fkfd.me>2021-11-24 21:35:37 +0800
committerFrederick Yin <fkfd@fkfd.me>2021-11-24 21:35:37 +0800
commit8bc1186ce0a25e8d67c942649819b0edff52e545 (patch)
tree0c988e1dc55c7a3b7e0b05da988b41606563249e /jimbrella
parent636f51dfd2ee16beb57cd2bd1c8b6325dcd73890 (diff)
Use dateutil to parse jForm date
Because jForm trims trailing 0's from milliseconds and Python's standard datetime.datetime.fromisoformat doesn't like that
Diffstat (limited to 'jimbrella')
-rw-r--r--jimbrella/jform.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/jimbrella/jform.py b/jimbrella/jform.py
index e9f2a50..dc9d769 100644
--- a/jimbrella/jform.py
+++ b/jimbrella/jform.py
@@ -1,7 +1,7 @@
import requests
import json
from pathlib import Path
-from datetime import datetime
+from dateutil.parser import isoparse
class JForm:
@@ -108,6 +108,7 @@ class JForm:
# when we exceed the total pages of a questionnaire
# instead it just returns 200 along with an empty data field
break
+
for sheet in sheets:
if sheet["id"] <= bookmark:
# is bookmark or earlier than bookmark
@@ -121,7 +122,7 @@ class JForm:
"id": ans[1]["answer"],
"phone": ans[2]["answer"],
"key": int(ans[3]["answer"]),
- "date": datetime.fromisoformat(sheet["submitted_at"]),
+ "date": isoparse(sheet["submitted_at"]),
}
)
page += 1