I've hit another issue when reading a file that has a missing create_date in the tasks table. Is there any reason that these can't be optional_dates?
xer = Xer.reader(xer_filepath)
^^^^^^^^^^^^^^^^^^^^^^^^
...
lib/python3.12/site-packages/xerparser/schemas/task.py", line 173, in __init__
self.create_date: datetime = datetime.strptime(data["create_date"], date_format)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/_strptime.py", line 554, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/_strptime.py", line 333, in _strptime
raise ValueError("time data %r does not match format %r" %
ValueError: time data '' does not match format '%Y-%m-%d %H:%M'
I'm able to get around this by updating:
self.create_date: datetime = datetime.strptime(data["create_date"], date_format)
self.update_date: datetime = datetime.strptime(data["update_date"], date_format)
To use the optional_date validator
self.create_date: datetime | None = optional_date(data["create_date"])
self.update_date: datetime | None = optional_date(data["update_date"])
I've hit another issue when reading a file that has a missing create_date in the tasks table. Is there any reason that these can't be optional_dates?
I'm able to get around this by updating:
To use the optional_date validator