Hi All,<br><br>(I wonder if this list is still active, but we&#39;ll see).<br><br>Either I don&#39;t fully understand how vDuration should work, or there is a bug (or rather a shortcoming) in it. When loading a iCalendar file created by KOrganizer, the alarms are mutilated. Here&#39;s an short example of what is happening which I think isn&#39;t correct:<br>
<br>&gt;&gt;&gt; vDuration(timedelta(days=-1)).ical() # Correct<br>&#39;-P1D&#39;<br>&gt;&gt;&gt; vDuration(timedelta(days=1, hours=5)).ical() # Correct<br>&#39;P1DT5H&#39;<br>&gt;&gt;&gt; vDuration(timedelta(hours=-5)).ical() # Incorrect?<br>
&#39;-P1DT19H&#39;<br><br>I would have expected this to render as &#39;-PT15H&#39;, which is the way how KOrganizer marshals negative time offsets for alarms. So now, when I load a iCal file generated by KOrganizer and write it back again, all the alarms are FUBAR. It would appear (from the test-cases mentioned in the docstring of the vDuration ical() method) the original author of the package failed to notice that converting anything other than negative days fails. (or I&#39;m just not getting how this should be used ;-) )<br>
<br>I&#39;ve written a patch to correct the problem, in case anybody is interested. With the patch (see attachment, if the lists supports them. Otherwise I&#39;ll repost), the marshalling is as follows:<br><br>&gt;&gt;&gt; from icalendar import vDuration<br>
&gt;&gt;&gt; from datetime import timedelta<br>&gt;&gt;&gt; vDuration(timedelta(days=1, hours=5)).ical()<br>&#39;P1DT5H&#39;<br>&gt;&gt;&gt; vDuration(timedelta(hours=-5)).ical()<br>&#39;-PT5H&#39;<br>&gt;&gt;&gt; vDuration(timedelta(days=-10, hours=-5, minutes=-40)).ical()<br>
&#39;-P10DT5H40M&#39;<br><br>All the old testcases still work correctly after applying the patch. <br><br>(PS: I haven&#39;t looked at the iCalendar standard to see if the current way iCalendar python module&#39;s marshalling to iCal text is correct and KOrganizer is at fault here).<br>
<br><br>Grtz,<br><br>Ferry<br><br>