How to use the rrule.RRule.WEEKLY 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 bcgov / queue-management / frontend / src / appointments / appt-booking-modal / appt-blackout-modal.vue View on Github external
let end_hour = parseInt(moment(this.recurring_end_time).utc().clone().format('HH'))
            let end_minute = parseInt(moment(this.recurring_end_time).utc().clone().format('mm'))
            let duration = moment.duration(moment(this.recurring_end_time).diff(moment(this.recurring_start_time)))
            let duration_minutes = duration.asMinutes()
            let input_frequency = null
            let local_dates_array = []

            switch(this.selected_frequency[0]){
              case 0:
                input_frequency = RRule.YEARLY;
                break;
              case 1:
                input_frequency = RRule.MONTHLY;
                break;
              case 2:
                input_frequency = RRule.WEEKLY;
                break;
              case 3:
                input_frequency = RRule.DAILY;
                break;
            }

            if(isNaN(start_year) == false || isNaN(end_year) == false) {
              // TODO Might be Deprecated -- IF RRule Breaks, this is where it will happen
              // TODO remove tzid from rule object
              let date_start = new Date(Date.UTC(start_year, start_month - 1, start_day, start_hour, start_minute))
              let until = new Date(Date.UTC(end_year, end_month - 1, end_day, end_hour, end_minute))
              const rule = new RRule({
                freq: input_frequency,
                count: this.selected_count,
                byweekday: this.selected_weekdays,
                dtstart: date_start,
github bcgov / queue-management / frontend / src / booking / booking-blackout-modal.vue View on Github external
//let end_hour = parseInt(moment(this.recurring_booking_end_time).utc().clone().format('HH'))
          //let end_minute = parseInt(moment(this.recurring_booking_end_time).utc().clone().format('mm'))
          let duration = moment.duration(moment(this.recurring_booking_end_time).diff(moment(this.recurring_booking_start_time)))
          let duration_minutes = duration.asMinutes()
          let booking_input_frequency = null
          let local_booking_dates_array = []

          switch(this.selected_booking_frequency[0]){
            case 0:
              booking_input_frequency = RRule.YEARLY;
              break;
            case 1:
              booking_input_frequency = RRule.MONTHLY;
              break;
            case 2:
              booking_input_frequency = RRule.WEEKLY;
              break;
            case 3:
              booking_input_frequency = RRule.DAILY;
              break;
          }

          if(isNaN(start_year) == false || isNaN(end_year) == false){

            // TODO Might be Deprecated -- IF RRule Breaks, this is where it will happen
            // Removed hours and minutes from date_start and until
            let date_start = new Date(Date.UTC(start_year, start_month -1, start_day))
            let until = new Date(Date.UTC(end_year, end_month -1, end_day))

            const rule = new RRule({
              freq: booking_input_frequency,
              count: this.selected_booking_count,
github bcgov / queue-management / frontend / src / booking / other-booking-modal.vue View on Github external
let duration_start = moment(this.other_recurring_start_time).utc()
        let duration_end = moment(this.other_recurring_end_time).utc()
        let duration = moment.duration(duration_end.diff(duration_start))
        let duration_minutes = duration.asMinutes()
        let input_frequency = null
        let local_other_dates_array = []

        switch(this.other_selected_frequency[0]){
          case 0:
            input_frequency = RRule.YEARLY;
            break;
          case 1:
            input_frequency = RRule.MONTHLY;
            break;
          case 2:
            input_frequency = RRule.WEEKLY;
            break;
          case 3:
            input_frequency = RRule.DAILY;
            break;
        }

        if(isNaN(start_year) == false || isNaN(end_year) == false){
          // TODO Might be Deprecated -- IF RRule Breaks, this is where it will happen
          let date_start = new Date(Date.UTC(start_year, start_month-1, start_day))
          let until = new Date(Date.UTC(end_year, end_month-1, end_day))

          const rule = new RRule({
            freq: input_frequency,
            count: this.other_selected_count,
            byweekday: this.other_selected_weekdays,
            dtstart: date_start,
github bcgov / queue-management / frontend / src / booking / other-booking-modal.vue View on Github external
invoice: null,
        rate: null,
        start:'',
        end:'',
        other_recurring_start_time: null,
        other_recurring_end_time: null,
        other_recurring_start_date: null,
        other_recurring_end_date: null,
        other_recurring_display_time: null,
        other_recurring_display_date: null,
        other_selected_frequency: [],
        other_selected_weekdays: [],
        other_selected_count: '',
        yearly: RRule.YEARLY,
        monthly: RRule.MONTHLY,
        weekly: RRule.WEEKLY,
        daily: RRule.DAILY,
        monday: RRule.MO,
        tuesday: RRule.TU,
        wednesday: RRule.WE,
        thursday: RRule.TH,
        friday: RRule.FR,
        other_single_event: true,
        other_recurring_event: true,
        other_rrule_text: '',
        other_rrule_array: [],
        recurring_title: '',
        recurring_contact_information: '',
        recurring_fees: '',
        single_input_boolean: false,
        recurring_input_boolean: false,
        recurring_form_state: '',
github magda-io / magda / magda-web-client / src / Components / Dataset / Add / AccrualPeriodicityInput / index.tsx View on Github external
return option => {
            if (
                typeof props.onAccrualPeriodicityRecurrenceRuleChange !==
                "function"
            )
                return;
            const newRecurrenceRuleOptions: Partial = {
                ...recurrenceRuleOptions,
                freq: option.value
            };
            if (option.value !== RRule.WEEKLY) {
                delete newRecurrenceRuleOptions.byweekday;
            } else {
                newRecurrenceRuleOptions.byweekday =
                    DEFAULT_CUSTOM_INPUT_VALUE.byweekday;
            }
            const rruleStr = new RRule(newRecurrenceRuleOptions).toString();
            props.onAccrualPeriodicityRecurrenceRuleChange(rruleStr);
        };
    };
github magda-io / magda / magda-web-client / src / Components / Dataset / Add / AccrualPeriodicityInput / index.tsx View on Github external
label: "Week",
        value: RRule.WEEKLY
    },
    {
        label: "Day",
        value: RRule.DAILY
    },
    {
        label: "Hour",
        value: RRule.HOURLY
    }
];

const DEFAULT_CUSTOM_INPUT_VALUE = {
    interval: 1,
    freq: RRule.WEEKLY,
    byweekday: [RRule.MO] as Weekday[]
};

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
            )
github magda-io / magda / magda-web-client / src / Components / Dataset / Add / AccrualPeriodicityInput / index.tsx View on Github external
accrualPeriodicity?: string;
    accrualPeriodicityRecurrenceRule?: string;
}

const REPEAT_OPTIONS = [
    {
        label: "Year",
        value: RRule.YEARLY
    },
    {
        label: "Month",
        value: RRule.MONTHLY
    },
    {
        label: "Week",
        value: RRule.WEEKLY
    },
    {
        label: "Day",
        value: RRule.DAILY
    },
    {
        label: "Hour",
        value: RRule.HOURLY
    }
];

const DEFAULT_CUSTOM_INPUT_VALUE = {
    interval: 1,
    freq: RRule.WEEKLY,
    byweekday: [RRule.MO] as Weekday[]
};
github bcgov / queue-management / frontend / src / appointments / appt-booking-modal / appt-blackout-modal.vue View on Github external
start_time: null,
            end_time: null,
            notes: '',
            user_name: '',
            user_contact_info: '',
            selected_frequency: [],
            selected_weekdays: [],
            selected_count: '',
            recurring_start_time: null,
            recurring_end_time: null,
            recurring_start_date: null,
            recurring_end_date: null,
            recurring_array: '',
            yearly: RRule.YEARLY,
            monthly: RRule.MONTHLY,
            weekly: RRule.WEEKLY,
            daily: RRule.DAILY,
            monday: RRule.MO,
            tuesday: RRule.TU,
            wednesday: RRule.WE,
            thursday: RRule.TH,
            friday: RRule.FR,
            single_blackout_boolean: true,
            recurring_blackout_boolean: true,
            rrule_array: [],
            rrule_text: '',
            recurring_input_boolean: false,
            single_input_boolean: false,
            next_boolean: false,
            single_input_state: '',
            recurring_input_state: ''
          }
github bcgov / queue-management / frontend / src / booking / booking-blackout-modal.vue View on Github external
selected: [],
          selectedLength: 0,
          room_id_list: [],
          room_fields: ['selected', 'title'],
          single_booking_blackout_boolean: true,
          recurring_booking_blackout_boolean: true,
          selected_booking_frequency: [],
          selected_booking_weekdays: [],
          selected_booking_count: '',
          recurring_booking_start_time: null,
          recurring_booking_end_time: null,
          recurring_booking_start_date: null,
          recurring_booking_end_date: null,
          yearly: RRule.YEARLY,
          monthly: RRule.MONTHLY,
          weekly: RRule.WEEKLY,
          daily: RRule.DAILY,
          monday: RRule.MO,
          tuesday: RRule.TU,
          wednesday: RRule.WE,
          thursday: RRule.TH,
          friday: RRule.FR,
          booking_rrule_array: [],
          booking_rrule_text: '',
          single_input_boolean: false,
          recurring_input_boolean: false,
          recurring_form_state: '',
          single_form_state: ''
        }
      },
      methods: {