Alarm Trigger field from Apple OSX iCal breaks with Value Error #69

ieb opened this Issue Oct 17, 2012 · 3 comments


None yet

3 participants



is parsed with Calendar.from_string(...) it generates
raise ValueError('Invalid iCalendar duration: %s' % ical)
ValueError: Invalid iCalendar duration: P1501W3DT7H28M16S

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

 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 [ISO 8601] basic format for
the duration of time. The format can represent durations in terms of
weeks, days, hours, minutes, and seconds.

IIUC the Applie iCal format is not to the spec since it splits up a

T7H28M16S looks Ok

P1501W3D looks wrong.

1 Week 3 Days but what is the 150 ?

Is there any way to ignore the component if parsing the duration fails ?


Partial solution is to do
Alarm.ignore_exceptions = True

before starting the parse.


If I can patch this will you take the pull request? Had same issue, pretty problematic, but the ignore_exceptions hack does work.

Plone Collective member

sure, pull requests are very welcome. please take a look at the CONTRIBUTING file

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