Skip to content

Commit e3196aa

Browse files
committed
parse ISO format with timezone offset
1 parent 31aedbd commit e3196aa

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

database/scrape_common.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,12 @@ def convert_to_iso(date_str):
192192
except ValueError:
193193
pass
194194

195+
# Try to parse ISO format with timezone offset like '2013-08-17T02:00:00+02:00'
196+
try:
197+
return datetime.fromisoformat(date_str).strftime('%Y-%m-%d')
198+
except ValueError:
199+
pass
200+
195201
raise ValueError(f"Unsupported date format: {date_str}")
196202

197203

0 commit comments

Comments
 (0)