[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC2445] Discrepancy in 4.3.6 Duration (original and May 10th draft)



There seems to be a point of confusion in 4.3.6 Duration.

-- RFC2234 (ABNF) states:

3.6  Variable Repetition                                *Rule

   The operator "*" preceding an element indicates repetition. The full
   form is:

        <a>*<b>element

   where <a> and <b> are optional decimal values, indicating at least
   <a> and at most <b> occurrences of element.

   Default values are 0 and infinity so that *<element> allows any
   number, including zero; 1*<element> requires at  least  one;
   3*3<element> allows exactly 3 and 1*2<element> allows one or two

-- RFC2445 (iCal), Draft Update (May 10, 2001) states:

4.3.6 Duration

   Value Name: DURATION 

   Purpose: This value type is used to identify properties that contain
   a duration of time. 

   Formal Definition: The 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"

   Description: If the property permits, multiple "duration" values are
   specified by a COMMA character (US-ASCII decimal 44) separated list
   of values. The format is expressed as the [3] basic format for the
   duration of time. The format can represent durations in terms of
   weeks, days, hours, minutes, and seconds. 

   No additional content value encoding (i.e., BACKSLASH character
   encoding) are defined for this value type. 

   Example: A duration of 15 days, 5 hours and 20 seconds would be: 

        P15DT5H0M20S

   A duration of 7 weeks would be: 

        P7W

-- end

Per the ABNF provided in 4.3.6, P7W as stated directly above is not
valid - 1*DIGIT "W" is satisfied, but the "T", "H", "M", "S", and "D"
are also required.  I would propose changing the section to:

        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   = *1DIGIT "W"
        dur-hour   = *1DIGIT "H" [dur-minute]
        dur-minute = *1DIGIT "M" [dur-second]
        dur-second = *1DIGIT "S"
        dur-day    = *1DIGIT "D"

This allows P7W, P15DT5H0M20S, and P15DT4H10S as valid durations.

Working on Net::ICal (a perl module implemented the iCal RFC), I've
recently made a code change that allows us to reduce Duration values
down to only what is necessary to express the duration, by removing
zero-value elements.  Example:

   P15DT0H10M0S    would become    P15DT10M
   P0DT0H0M1S      would become    PT1S

However, this leads to further questions:  Is it allowed to specify
a time duration without providing the dur-day?  How does one express
a zero-value - "P0DT0H0M0S" would reduce to "P", which may or not be
an acceptable duration.

I'm not sure where to go from here.  I prefer being able to specify
time durations without requiring dur-week or dur-day.  Net::ICal is
using PT0S to express zero durations at this time, as it seemed the
most reasonable choice.

Also, there appears to be a thread on the Issues list that may be
of some relevance to this topic:

45 01/19/2001 [Typo] Several examples with durations are missing T

Thanks for your help and time.

coral