File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,8 @@ dependencies = [
4141 " Click>=8.1.3" ,
4242 " mysql-connector-python==8.4.0" ,
4343 " pytimeparse2" ,
44+ " python-dateutil>=2.9.0.post0" ,
45+ " types_python_dateutil" ,
4446 " python-slugify>=7.0.0" ,
4547 " simplejson>=3.19.0" ,
4648 " tqdm>=4.65.0" ,
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ pytest-cov
99pytest-mock
1010pytest-timeout
1111pytimeparse2
12+ python-dateutil>=2.9.0.post0
13+ types_python_dateutil
1214python-slugify>=7.0.0
1315types-python-slugify
1416simplejson>=3.19.1
Original file line number Diff line number Diff line change 55from datetime import date , timedelta
66from decimal import Decimal
77
8+ from dateutil .parser import ParserError
9+ from dateutil .parser import parse as dateutil_parse
810from pytimeparse2 import parse
911
1012
@@ -46,11 +48,11 @@ class CollatingSequences:
4648 RTRIM : str = "RTRIM"
4749
4850
49- def convert_date (value : t .Any ) -> date :
51+ def convert_date (value : t .Union [ str , bytes ] ) -> date :
5052 """Handle SQLite date conversion."""
5153 try :
52- return date . fromisoformat (value .decode ())
53- except ValueError as err :
54+ return dateutil_parse (value .decode () if isinstance ( value , bytes ) else value ). date ( )
55+ except ParserError as err :
5456 raise ValueError (f"DATE field contains { err } " ) # pylint: disable=W0707
5557
5658
You can’t perform that action at this time.
0 commit comments