I tried parsing P1D and got an error. I am pretty sure the 'T' in the regexp should be optional. Works elsewhere and the wikipedia article (as ISO do not publish standards publicly) says:
Date and time elements including their designator may be omitted if their value is zero, and lower-order elements may also be omitted for reduced precision. For example, "P23DT23H" and "P4Y" are both acceptable duration representations. However, at least one element must be present, thus "P" is not a valid representation for a duration of 0 seconds. "PT0S" or "P0D", however, are both valid and represent the same duration.
The fix may be as simple as addind a '?' after the T in the main regexp.
I tried parsing
P1Dand got an error. I am pretty sure the 'T' in the regexp should be optional. Works elsewhere and the wikipedia article (as ISO do not publish standards publicly) says:The fix may be as simple as addind a '?' after the T in the main regexp.