badboy / iso8601

Parsing ISO8601 dates using nom
https://docs.rs/iso8601/
MIT License
74 stars 22 forks source link

Durations are too restrictive in regard to number of digits #45

Closed hoodie closed 1 year ago

hoodie commented 1 year ago

according to RFC3339 page 13 a duration is described as follows

   dur-second        = 1*DIGIT "S"
   dur-minute        = 1*DIGIT "M" [dur-second]
   dur-hour          = 1*DIGIT "H" [dur-minute]
   dur-time          = "T" (dur-hour / dur-minute / dur-second)
   dur-day           = 1*DIGIT "D"
   dur-week          = 1*DIGIT "W"
   dur-month         = 1*DIGIT "M" [dur-day]
   dur-year          = 1*DIGIT "Y" [dur-month]
   dur-date          = (dur-day / dur-month / dur-year) [dur-time]

   duration          = "P" (dur-date / dur-time / dur-week)

hence a duration of 15min should be validly represent ad both PT15M and PT900S currently PT900S would however fail to parse.