Closed subbyte closed 1 year ago
The current to_datetime() function in firepit.timestamp only supports 0,3,6 sub-second digits, which is the limitation of datetime.datetime.fromisoformat().
to_datetime()
firepit.timestamp
datetime.datetime.fromisoformat()
>>> import datetime >>> datetime.datetime.fromisoformat("2022-02-01T00:00:00") datetime.datetime(2022, 2, 1, 0, 0) >>> datetime.datetime.fromisoformat("2022-02-01T00:00:00.123") datetime.datetime(2022, 2, 1, 0, 0, 0, 123000) >>> datetime.datetime.fromisoformat("2020-06-30T19:29:59.986123") datetime.datetime(2020, 6, 30, 19, 29, 59, 986123) >>> datetime.datetime.fromisoformat("2022-02-01T00:00:00.1") Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: Invalid isoformat string: '2022-02-01T00:00:00.1' >>> datetime.datetime.fromisoformat("2022-02-01T00:00:00.12") Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: Invalid isoformat string: '2022-02-01T00:00:00.12' >>> datetime.datetime.fromisoformat("2020-06-30T19:29:59.96346") Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: Invalid isoformat string: '2020-06-30T19:29:59.96346'
Help needed to make it work on variable number of sub-second digits input.
The current
to_datetime()
function infirepit.timestamp
only supports 0,3,6 sub-second digits, which is the limitation ofdatetime.datetime.fromisoformat()
.Help needed to make it work on variable number of sub-second digits input.