You do have to wonder just how many of the possible legal variations of ISO8601 this function can support. But concentrating on just the (optional) part after the decimal point.
A decimal fraction may be added to the lowest order time element present, in any of these representations. A decimal mark, either a comma or a dot (following ISO 80000-1 according to ISO 8601:1-2019,[25] which does not stipulate a preference except within International Standards, but with a preference for a comma according to ISO 8601:2004)[26] is used as a separator between the time element and its fraction. .....There is no limit on the number of decimal places for the decimal fraction.
I am rather upset about the decimal mark being either a dot or comma, with comma preferred. And "any number" of places. And after any (final) stanza, not just seconds. So, milli-minutes, micro-days etc ....
Obviously, extreme far right decimal places need to be ignored (not generate an exception). The definition of a file format I use has seven digits after a decimal dot and I need to convert all of them.
Davo