tritech / node-icalendar

iCalendar parser and generator for Node.js
MIT License
234 stars 50 forks source link

Bug in formatting duration values #8

Closed fomojola closed 11 years ago

fomojola commented 11 years ago

The current duration format in types.js does this (on line 130):

if(neg) dur.push('-');

which outputs property values like TRIGGER:P-T11M. Unfortunately, this is wrong (according to the spec at http://www.ietf.org/rfc/rfc2445.txt, it should be negative sign before the P, like dur-value = (["+"] / "-") "P" (dur-date / dur-time / dur-week)

It should really do this:

if(neg) dur.unshift('-');

which would produce the right thing: TRIGGER:-PT11M.