How to use the rrule function in rrule

To help you get started, we’ve selected a few rrule examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github superdesk / superdesk-planning / client / utils / events.js View on Github external
SA: RRule.SA,
        SU: RRule.SU,
    };

    const rules = {
        freq: freqMap[recurringRule.frequency],
        interval: parseInt(recurringRule.interval, 10) || 1,
        dtstart: startingDate.toDate(),
        count: 2,
    };

    if ('byday' in recurringRule) {
        rules.byweekday = recurringRule.byday.split(' ').map((day) => dayMap[day]);
    }

    const rule = new RRule(rules);

    let nextEvent = moment(rule.after(startingDate.toDate()));

    return nextEvent.isBetween(startingDate, endingDate) || nextEvent.isSame(endingDate);
};
github mattlewis92 / angular-calendar / projects / demos / app / demo-modules / recurring-events / component.ts View on Github external
this.recurringEvents.forEach(event => {
        const rule: RRule = new RRule({
          ...event.rrule,
          dtstart: moment(viewRender.period.start)
            .startOf('day')
            .toDate(),
          until: moment(viewRender.period.end)
            .endOf('day')
            .toDate()
        });
        const { title, color } = event;

        rule.all().forEach(date => {
          this.calendarEvents.push({
            title,
            color,
            start: moment(date).toDate()
          });
github Fafruch / react-rrule-generator / src / lib / utils / computeRRule / toString / computeRRule.js View on Github external
const computeRRule = ({ repeat, end, options }) => {
  const rruleObject = { ...computeRepeat(repeat), ...computeEnd(end), ...computeOptions(options) };
  const rrule = new RRule(rruleObject);
  return rrule.toString();
};
github remp2020 / remp / Beam / resources / assets / js / components / RecurrenceSelector.vue View on Github external
if (this.repeatEvery === 'week') {
                    let weekDays = []
                    for (let i=0; i < this.weekRecurrence.length; i++) {
                        if (this.weekRecurrence[i]){
                            weekDays.push(rRuleWeekDays[i])
                        }
                    }
                    ruleProps.byweekday = weekDays
                }
                if (this.endsOn === 'on') {
                    ruleProps.until = new Date(this.endsOnDate)
                } else if (this.endsOn === 'after') {
                    ruleProps.count = this.repeatCount
                }

                let rule = new RRule(ruleProps)
                this.callback(this.start, rule.toString())
            }
        },