[Issue 24704] DateTime.fromISOExtString Does Not Support ISO8601 Time Unit Fractions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 16 16:24:13 UTC 2024


https://issues.dlang.org/show_bug.cgi?id=24704

--- Comment #12 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
The documentation on fromISOExtString on each of the types says what that
function accepts on that type. In all cases, it is an ISO extended string which
corresponds to the portions of the time that type supports. The standard says
what ISO extended strings look like, but it does not require that all fields be
present in an ISO extended string, and there is no requirement that code
parsing an ISO extended string support every variant of ISO extended string in
existence, and none of the functions in std.datetime are intended to support
every variant of ISO extended string. Not even SysTime.fromISOExtString does,
since it doesn't support dates or times on their own (which would be valid ISO
extended strings so long as they're formatted correctly for those portions of
the date or time). As such, I see no problem with what these functions parse.
They do exactly what they say they'll do.

That being said, it is true that it's possible to pass an ISO extended string
which either has unsupported fields or which is missing required fields to
fromISOExtString. So, perhaps the exception's message should say something like
"String not in the required format:" instead of "Invalid ISO Extended String:".

So, I'll create a PR adjusting the error messages.

--


More information about the Digitalmars-d-bugs mailing list