File tree 3 files changed +9
-3
lines changed
3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,8 @@ dependencies = [
41
41
" Click>=8.1.3" ,
42
42
" mysql-connector-python==8.4.0" ,
43
43
" pytimeparse2" ,
44
+ " python-dateutil>=2.9.0.post0" ,
45
+ " types_python_dateutil" ,
44
46
" python-slugify>=7.0.0" ,
45
47
" simplejson>=3.19.0" ,
46
48
" tqdm>=4.65.0" ,
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ pytest-cov
9
9
pytest-mock
10
10
pytest-timeout
11
11
pytimeparse2
12
+ python-dateutil>=2.9.0.post0
13
+ types_python_dateutil
12
14
python-slugify>=7.0.0
13
15
types-python-slugify
14
16
simplejson>=3.19.1
Original file line number Diff line number Diff line change 5
5
from datetime import date , timedelta
6
6
from decimal import Decimal
7
7
8
+ from dateutil .parser import ParserError
9
+ from dateutil .parser import parse as dateutil_parse
8
10
from pytimeparse2 import parse
9
11
10
12
@@ -46,11 +48,11 @@ class CollatingSequences:
46
48
RTRIM : str = "RTRIM"
47
49
48
50
49
- def convert_date (value : t .Any ) -> date :
51
+ def convert_date (value : t .Union [ str , bytes ] ) -> date :
50
52
"""Handle SQLite date conversion."""
51
53
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 :
54
56
raise ValueError (f"DATE field contains { err } " ) # pylint: disable=W0707
55
57
56
58
You can’t perform that action at this time.
0 commit comments