Commit 35de7133 authored by Jen Huang's avatar Jen Huang
Browse files

add support for nth occurrence of weekdays

ex: 2MO (second Monday of month)
ex: -1SU (last Sunday of month)
parent 525c1eeb
......@@ -309,12 +309,12 @@ var ICalEvent = function(_data, calendar) {
data.repeating.byDay = [];
repeating.byDay.forEach(function(symbol) {
var s = symbol.toString().toUpperCase();
if(['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'].indexOf(s) === -1) {
throw '`repeating.byDay` contains invalid value `' + s + '`!';
var s = symbol.toString().toUpperCase().match(/^(\d*||-\d+)(\w+)$/);
if(['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'].indexOf(s[2]) === -1) {
throw '`repeating.byDay` contains invalid value `' + s[2] + '`!';
}
data.repeating.byDay.push(s);
data.repeating.byDay.push(s[1]+s[2]);
});
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment