Comparing version 0.6.0 to 0.6.1
@@ -73,5 +73,11 @@ "use strict"; | ||
var exceptions = []; | ||
var ex, i=0; | ||
while(ex = this.getPropertyValue('EXDATE', i++)) | ||
exceptions.push.apply(exceptions, ex); | ||
return new RRule(rr, { | ||
DTSTART: this.getPropertyValue('DTSTART'), | ||
DTEND: this.getPropertyValue('DTEND') | ||
DTEND: this.getPropertyValue('DTEND'), | ||
EXDATE: exceptions | ||
}); | ||
@@ -78,0 +84,0 @@ } |
{ | ||
"name": "icalendar", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"author": "James Emerton <james@tri-tech.com>", | ||
@@ -5,0 +5,0 @@ "description": "RFC5545 iCalendar parser/generator", |
@@ -76,19 +76,16 @@ | ||
// it("respects EXDATE full date parts", function() { | ||
// var feb01 = new Date(2011,1,1); | ||
// feb01.date_only = true; | ||
// | ||
// var rrule = new RRule('FREQ=MONTHLY', { | ||
// DTSTART: new Date(2011,0,1,10), | ||
// EXDATE: [feb01, new Date(2011,2,1, 10,0,0), new Date(2011,3,1, 12,0,0)] | ||
// }); | ||
// | ||
// expect(rrule.nextOccurences(new Date(2010,11,31), 3)) | ||
// .toEqual([ | ||
// new Date(2011,0,1,10), | ||
// new Date(2011,3,1,10), | ||
// new Date(2011,4,1,10) | ||
// ]); | ||
// }); | ||
it("respects EXDATE full date parts", function() { | ||
var rrule = new RRule('FREQ=MONTHLY', { | ||
DTSTART: new Date(2011,0,1, 10,0,0), | ||
EXDATE: [date_only(2011,1,1), new Date(2011,2,1, 10,0,0), new Date(2011,3,1, 12,0,0)] | ||
}); | ||
expect(rrule.nextOccurences(new Date(2010,11,31), 3)) | ||
.toEqual([ | ||
new Date(2011,0,1,10), | ||
new Date(2011,3,1,10), | ||
new Date(2011,4,1,10) | ||
]); | ||
}); | ||
describe("yearly recurrence", function() { | ||
@@ -95,0 +92,0 @@ it("handles yearly recurrence", function() { |
@@ -106,3 +106,27 @@ | ||
}); | ||
it('uses EXDATE properties when calculating recurrence', function() { | ||
var cal = icalendar.parse_calendar( | ||
'BEGIN:VCALENDAR\r\n'+ | ||
'PRODID:-//Bobs Software Emporium//NONSGML Bobs Calendar//EN\r\n'+ | ||
'VERSION:2.0\r\n'+ | ||
'BEGIN:VEVENT\r\n'+ | ||
'DTSTAMP:20111202T165900\r\n'+ | ||
'UID:testuid@someotherplace.com\r\n'+ | ||
'DTSTART:20110101T100000\r\n'+ | ||
'RRULE:FREQ=MONTHLY\r\n'+ | ||
'EXDATE;VALUE=DATE:20110201\r\n'+ | ||
'EXDATE:20110301T100000,20110401T120000\r\n'+ | ||
'END:VEVENT\r\n'+ | ||
'END:VCALENDAR\r\n'); | ||
var rrule = cal.getComponents('VEVENT')[0].rrule(); | ||
expect(rrule.nextOccurences(new Date(2010,11,31), 3)) | ||
.toEqual([ | ||
new Date(2011,0,1,10), | ||
new Date(2011,3,1,10), | ||
new Date(2011,4,1,10) | ||
]); | ||
}); | ||
}); | ||
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
191693
1992