MCPcopy Create free account
hub / github.com/DHTMLX/scheduler / parseRrule

Function parseRrule

codebase/sources/dhtmlxscheduler.es.js:17069–17117  ·  view source on GitHub ↗
(line)

Source from the content-addressed store, hash-verified

17067 }
17068}
17069function parseRrule(line) {
17070 var strippedLine = line.replace(/^RRULE:/i, "");
17071 var options = parseDtstart(strippedLine);
17072 var attrs = line.replace(/^(?:RRULE|EXRULE):/i, "").split(";");
17073 attrs.forEach(function(attr) {
17074 var _a = attr.split("="), key = _a[0], value = _a[1];
17075 switch (key.toUpperCase()) {
17076 case "FREQ":
17077 options.freq = Frequency[value.toUpperCase()];
17078 break;
17079 case "WKST":
17080 options.wkst = Days[value.toUpperCase()];
17081 break;
17082 case "COUNT":
17083 case "INTERVAL":
17084 case "BYSETPOS":
17085 case "BYMONTH":
17086 case "BYMONTHDAY":
17087 case "BYYEARDAY":
17088 case "BYWEEKNO":
17089 case "BYHOUR":
17090 case "BYMINUTE":
17091 case "BYSECOND":
17092 var num = parseNumber(value);
17093 var optionKey = key.toLowerCase();
17094 options[optionKey] = num;
17095 break;
17096 case "BYWEEKDAY":
17097 case "BYDAY":
17098 options.byweekday = parseWeekday(value);
17099 break;
17100 case "DTSTART":
17101 case "TZID":
17102 var dtstart = parseDtstart(line);
17103 options.tzid = dtstart.tzid;
17104 options.dtstart = dtstart.dtstart;
17105 break;
17106 case "UNTIL":
17107 options.until = untilStringToDate(value);
17108 break;
17109 case "BYEASTER":
17110 options.byeaster = Number(value);
17111 break;
17112 default:
17113 throw new Error("Unknown RRULE property '" + key + "'");
17114 }
17115 });
17116 return options;
17117}
17118function parseNumber(value) {
17119 if (value.indexOf(",") !== -1) {
17120 var values = value.split(",");

Callers 1

parseLineFunction · 0.70

Calls 4

parseDtstartFunction · 0.70
parseNumberFunction · 0.70
parseWeekdayFunction · 0.70
untilStringToDateFunction · 0.70

Tested by

no test coverage detected