HWilmer
HWilmer

Reputation: 566

ISO 8601 Duration, mix week and date, time?

This is part of the RFC 5545 specification, which is based on the ISO 8601:

   Format Definition:  This value type is defined by the following
      notation:

       dur-value  = (["+"] / "-") "P" (dur-date / dur-time / dur-week)

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

I do not quite understand the dur-value formatting. I think that the / stand for an or right? That means that you should not be able to mix dur-date, dur-time and dur-week?

If that is the case then the chaining of dur-date = dur-day [dur-time] actually permits the use of dur-date and dur-time in the same duration value, but forbids that dur-week is mixed with anything else.

So this P1W1D duration value would be invalid?

Upvotes: 1

Views: 155

Answers (1)

Gustav
Gustav

Reputation: 56026

Yes. Otherwise it should have read:

  dur-week   = 1*DIGIT "W" [dur-date]

or perhaps:

  dur-week   = 1*DIGIT "W" ([dur-date] / [dur-time])

Upvotes: 0

Related Questions