Skip to content

Durations without 'T' are not parsed #1

Description

@pgalbavy-itrs

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions