You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
More documentation on this choice is available here. However, reading the document I found at least 4 instances of different standards (some of which are compatible with ISO8061 which is confusing from my perspective).
This format does not conform to ISO8061 conventions since, as per the ISO:
3.2.6 Separator symbols
In date and time expressions and date and time representations, the following characters are used as separators.
“-” (hyphen) the “-” hyphen character, in extended format, separates the time scale components for “year” and “month”, “year” and “week”, “year” and “day”, “month” and “day”, and “week” and “day”.
“:” (colon) the “:” colon character, in extended format, seperates the time scale components for “hour” and “minute”, and “minute” and “second”.
I understand the intentions behind this choice since ":" is probably a difficult character to support (e.g. not allowed in paths).
However, using a custom parser ensures that users have to rely on this library to parse their datetimes. Instead, I propose we support the ISO8601 format by relying on the stdlib datetime.datetime.fromisoformat method. E.g.:
(I should point out that the string that I am using is not necessarily ISO8061 compliant since it mixes the compact with the extended format, I would prefer to not use "-" at all for the date portion, but people usually like to have it for readability and python seems to consider it ISO compliant, so....)
Having this implemented would allow users to use datetimes that are ISO8061 compliant instead of being forced to use the current non-ISO format.
The idea would be to modify the aforementioned parser method to have try-catch routine that uses the fromisoformat as default and falls back on the current parser to ensure backward compatiblity.
Finally, I would encourage people to use the format that is laid out on this PR where feedback for the current datetime format is being discussed.
The text was updated successfully, but these errors were encountered:
The current parser for
datetime
in file names uses the following format"%Y-%m-%d_%H-%M-%S"
aind-data-schema-models/src/aind_data_schema_models/data_name_patterns.py
Line 53 in 412736e
More documentation on this choice is available here. However, reading the document I found at least 4 instances of different standards (some of which are compatible with ISO8061 which is confusing from my perspective).
This format does not conform to ISO8061 conventions since, as per the ISO:
I understand the intentions behind this choice since ":" is probably a difficult character to support (e.g. not allowed in paths).
However, using a custom parser ensures that users have to rely on this library to parse their datetimes. Instead, I propose we support the ISO8601 format by relying on the stdlib
datetime.datetime.fromisoformat
method. E.g.:(I should point out that the string that I am using is not necessarily ISO8061 compliant since it mixes the compact with the extended format, I would prefer to not use "-" at all for the date portion, but people usually like to have it for readability and python seems to consider it ISO compliant, so....)
Having this implemented would allow users to use datetimes that are ISO8061 compliant instead of being forced to use the current non-ISO format.
The idea would be to modify the aforementioned parser method to have try-catch routine that uses the
fromisoformat
as default and falls back on the current parser to ensure backward compatiblity.Finally, I would encourage people to use the format that is laid out on this PR where feedback for the current datetime format is being discussed.
The text was updated successfully, but these errors were encountered: