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

Function optionsToString

codebase/sources/dhtmlxscheduler.js:17180–17250  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

17178 return DateWithZone2;
17179 }();
17180 function optionsToString(options) {
17181 var rrule = [];
17182 var dtstart = "";
17183 var keys = Object.keys(options);
17184 var defaultKeys2 = Object.keys(DEFAULT_OPTIONS$1);
17185 for (var i = 0; i < keys.length; i++) {
17186 if (keys[i] === "tzid")
17187 continue;
17188 if (!includes(defaultKeys2, keys[i]))
17189 continue;
17190 var key = keys[i].toUpperCase();
17191 var value = options[keys[i]];
17192 var outValue = "";
17193 if (!isPresent(value) || isArray(value) && !value.length)
17194 continue;
17195 switch (key) {
17196 case "FREQ":
17197 outValue = RRule.FREQUENCIES[options.freq];
17198 break;
17199 case "WKST":
17200 if (isNumber(value)) {
17201 outValue = new Weekday(value).toString();
17202 } else {
17203 outValue = value.toString();
17204 }
17205 break;
17206 case "BYWEEKDAY":
17207 key = "BYDAY";
17208 outValue = toArray(value).map(function(wday) {
17209 if (wday instanceof Weekday) {
17210 return wday;
17211 }
17212 if (isArray(wday)) {
17213 return new Weekday(wday[0], wday[1]);
17214 }
17215 return new Weekday(wday);
17216 }).toString();
17217 break;
17218 case "DTSTART":
17219 dtstart = buildDtstart(value, options.tzid);
17220 break;
17221 case "UNTIL":
17222 outValue = timeToUntilString(value, !options.tzid);
17223 break;
17224 default:
17225 if (isArray(value)) {
17226 var strValues = [];
17227 for (var j = 0; j < value.length; j++) {
17228 strValues[j] = String(value[j]);
17229 }
17230 outValue = strValues.toString();
17231 } else {
17232 outValue = String(value);
17233 }
17234 }
17235 if (outValue) {
17236 rrule.push([key, outValue]);
17237 }

Callers 1

dhtmlxscheduler.jsFile · 0.70

Calls 6

includesFunction · 0.70
isPresentFunction · 0.70
isNumberFunction · 0.70
toArrayFunction · 0.70
buildDtstartFunction · 0.70
timeToUntilStringFunction · 0.70

Tested by

no test coverage detected