Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
id: profile.id,
owner: profile.owner,
name: profile.name,
version: profile.version,
title: profile.title,
include: job.profiles.some(id => id === profile.id)
}));
});
// schedule form
const hasSchedule = job.recurrence.length > 0;
scheduleGroup.get('name').setValue(job.name);
scheduleGroup.get('include').setValue(hasSchedule);
if (hasSchedule) {
const rule = RRule.parseString(job.recurrence);
const hasUntil = !!rule.until;
const hasRepeat = !!rule.interval;
const start = moment.utc(rule.dtstart);
scheduleGroup.get('start.datetime').setValue({
month: start.month(),
date: start.date(),
year: start.year(),
hour: start.hour(),
minute: start.minute()
});
if (hasUntil) {
const end = moment.utc(rule.until);
scheduleGroup.get('end.include').setValue(hasUntil);
scheduleGroup.get('end.datetime').setValue({
delete data[k];
// only events with summary are interesting
if ((ev.summary !== undefined) && (ev.type === 'VEVENT')) {
adapter.log.debug('ev:' + JSON.stringify(ev));
if (!ev.end) {
ev.end = ce.clone(ev.start);
if (!ev.start.getHours() && !ev.start.getMinutes() && !ev.start.getSeconds()) {
ev.end.setDate(ev.end.getDate() + 1);
}
}
// aha, it is RRULE in the event --> process it
if (ev.rrule !== undefined) {
const eventLength = ev.end.getTime() - ev.start.getTime();
const options = RRule.parseString(ev.rrule.toString());
// convert times temporary to UTC
options.dtstart = addOffset(ev.start, -getTimezoneOffset(ev.start));
if (options.until) {
options.until = addOffset(options.until, -getTimezoneOffset(options.until));
}
adapter.log.debug('options:' + JSON.stringify(options));
const rule = new RRule(options);
let now3 = new Date(now2.getTime() - eventLength);
if (now2 < now3) {
now3 = now2;
}
adapter.log.debug('RRule event:' + ev.summary + '; start:' + ev.start.toString() + '; endpreview:' + endpreview.toString() + '; today:' + today + '; now2:' + now2 + '; now3:' + now3 + '; rule:' + JSON.stringify(rule));
let dates = [];
IcalFile.prototype.getRrule = function(event)
{
if (undefined === event.getProperty('RRULE')) {
return null;
}
let RRule = require('rrule').RRule;
let options = RRule.parseString(event.getProperty('RRULE').format()[0].substr(6));
options.dtstart = event.getProperty('DTSTART').value;
return new RRule(options);
};
function processRRule(ev, endpreview, today, realnow, node, config) {
var eventLength = ev.end.getTime() - ev.start.getTime();
var options = RRule.parseString(ev.rrule.toString());
options.dtstart = addOffset(ev.start, -getTimezoneOffset(ev.start));
if (options.until) {
options.until = addOffset(options.until, -getTimezoneOffset(options.until));
}
node.debug('options:' + JSON.stringify(options));
var rule = new RRule(options);
var now2 = new Date();
now2.setHours(0, 0, 0, 0);
var now3 = new Date(now2.getTime() - eventLength);
if (now2 < now3) now3 = now2;
node.debug(
'RRule event:' +
ev.summary +
'; start:' +
ev.start.toString() +
function processRRule(ev, endpreview, today, realnow, node, config) {
var eventLength = ev.end.getTime() - ev.start.getTime();
var options = RRule.parseString(ev.rrule.toString());
options.dtstart = addOffset(ev.start, -getTimezoneOffset(ev.start));
if (options.until) {
options.until = addOffset(options.until, -getTimezoneOffset(options.until));
}
node.debug('options:' + JSON.stringify(options));
var rule = new RRule(options);
var now2 = new Date();
now2.setHours(0, 0, 0, 0);
var now3 = new Date(now2.getTime() - eventLength);
if (now2 < now3)
now3 = now2;
node.debug('RRule event:' +
ev.summary +
'; start:' +
ev.start.toString() +
'; endpreview:' +
const AccrualPeriodicityInput: FunctionComponent = props => {
const recurrenceRuleOptions = props.accrualPeriodicityRecurrenceRule
? RRule.parseString(props.accrualPeriodicityRecurrenceRule)
: DEFAULT_CUSTOM_INPUT_VALUE;
const onWeekDayClick = (
recurrenceRuleOptions: Partial,
weekday: Weekday
) => {
return () => {
const selectedWeekDays: Weekday[] = Array.isArray(
recurrenceRuleOptions.byweekday
)
? (recurrenceRuleOptions.byweekday as Weekday[])
: [];
const idx = selectedWeekDays.indexOf(weekday);
const newSelectedWeekDays =
idx === -1