Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upcase byDay even when used with bySetPos #205

Merged
merged 1 commit into from
Aug 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ event.repeating({
interval: 2,
until: new Date('Jan 01 2014 00:00:00 UTC'),
byDay: ['su', 'mo'], // repeat only sunday and monday
byMonth: [1, 2], // repeat only in january und february,
byMonth: [1, 2], // repeat only in january and february,
byMonthDay: [1, 15], // repeat only on the 1st and 15th
bySetPos: 3, // repeat every 3rd sunday (will take the first element of the byDay array)
exclude: [new Date('Dec 25 2013 00:00:00 UTC')], // exclude these dates
Expand Down
2 changes: 1 addition & 1 deletion src/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ class ICalEvent {
throw '`repeating.bySetPos` contains invalid value `' + repeating.bySetPos + '`!';
}

c._data.repeating.byDay = [repeating.byDay[0]];
c._data.repeating.byDay.splice(1);
c._data.repeating.bySetPos = repeating.bySetPos;
}

Expand Down
3 changes: 2 additions & 1 deletion test/test_event.js
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,8 @@ describe('ical-generator Event', function () {
it('setter should update repeating.bySetPos', function () {
const e = new ICalEvent(null, new ICalCalendar());

e.repeating({freq: 'monthly', byDay: ['SU'], bySetPos: 2});
e.repeating({freq: 'monthly', byDay: ['su'], bySetPos: 2});
assert.strictEqual(e._data.repeating.byDay[0], 'SU');
assert.strictEqual(e._data.repeating.bySetPos, 2);
});

Expand Down