labapi.util.extract.to_datetime#

labapi.util.extract.to_datetime(s: str) datetime[source]#

Convert a LabArchives ISO-8601 timestamp to a datetime.

LabArchives spells UTC as a trailing Z, which datetime.datetime.fromisoformat() does not accept before Python 3.11.

Parameters:

s – The timestamp to convert.

Returns:

The parsed datetime.

Raises:

ValueError – If the string is not a valid ISO-8601 timestamp.