Skip to content

Commit

Permalink
Merge pull request #16 from andeee/fix-modified-recurrence-2
Browse files Browse the repository at this point in the history
fix: modified recurrences are now queried correctly
  • Loading branch information
mifi authored Apr 24, 2020
2 parents 3f174f2 + 0de32aa commit 8cbe7b4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"node": ">=4"
},
"dependencies": {
"ical.js": "1.2.2"
"ical.js": "^1.2.2"
},
"devDependencies": {
"env": "0.0.2",
Expand Down
12 changes: 11 additions & 1 deletion test/ical-expander.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,24 @@ it('should parse issue 285 case correctly', function () {
const events = new IcalExpander({ ics: icaljsIssue285 })
.between(new Date('2017-01-03T00:00:00.000Z'), new Date('2017-01-25T00:00:00.000Z'));

assert.deepEqual(events.events.map(e => e.startDate.toJSDate().toISOString()), ['2017-01-18T08:00:00.000Z']);
assert.deepEqual(events.events.map(e => e.startDate.toJSDate().toISOString()), []);
assert.deepEqual(events.occurrences.map(e => e.startDate.toJSDate().toISOString()), [
'2017-01-03T08:00:00.000Z',
'2017-01-10T08:00:00.000Z',
'2017-01-18T08:00:00.000Z',
'2017-01-24T08:00:00.000Z',
]);
});

it('should show recurring modified date using ical.js issue 285', function () {
const events = new IcalExpander({ ics: icaljsIssue285 })
.between(new Date('2017-01-18T00:00:00.000Z'), new Date('2017-01-19T00:00:00.000Z'));

assert.equal(events.events.length, 0);
assert.equal(events.occurrences.length, 1);
assert.equal(events.occurrences[0].item.summary, 'test event');
});

it('should parse all recurring events without going on forever', function () {
const events = new IcalExpander({ ics: recurIcs })
.all();
Expand Down

0 comments on commit 8cbe7b4

Please sign in to comment.