applyPattern () {
        let _self = this,
            pattern = _self.$patternField.val();

        // Toggle visibility of endDate field by showing/hiding it's container (based on Pulsar markup) 
        if (typeof _self.$endDateFieldContainer !== 'undefined') {
            if (pattern === '1day') {
                _self.$endDateFieldContainer.hide();
                _self.$endDateField
                    .val(moment(_self.originalEndDate, _self.dateFormatInternal).format(_self.localeFormat))
                    .attr('disabled', true)
                    .trigger('change')
                    .val('');

                // reset selected state on startDate
                _self.clndr.element.find('[data-day="' + _self.clndr.options.constraints.startDate + '"]').parent().addClass('selected');
            }
            else {
                _self.$endDateFieldContainer.show();
                _self.$endDateField.attr('disabled', false);
            }
        }

        // Show the weekday picker if the pattern is `weekly/fortnightly`
        if (pattern === 'weekly' || pattern === 'fortnight') {

            // Choose the weekday based on the startDate, only if weekdays have not been supplied on init()
            if (!_self.originalWeekdays.length) {
                let day = moment(_self.clndr.options.constraints.startDate, _self.dateFormatInternal).day(),
                    dayNo = day != 0 ? day : 7; 
                
                _self.$html.find('[name="ercal-weekdays"][value="' + dayNo + '"]').prop('checked', true);
            }

            _self.$weekdayPicker.show();
            _self.toggleWeekday();
        }
        else {
            _self.$html.find('[name="ercal-weekdays"]').prop('checked', false); 
            _self.$weekdayPicker.hide();
        }

        // If we're using the weekly pattern, this will have been painted appropriately before this point
        if (pattern !== 'weekly' && pattern !== 'fortnight') {
            // Unpaint the currently stored pattern
            _self.paintMonth(_self.clndr.month, 'clear');

            /*
                Set the new recurrence pattern

                Any dates in the datesToAdd / datesToDel collections will maintain their state
                and override the pattern
            */
            _self.setPattern(pattern);
            _self.paintMonth(_self.clndr.month, 'repeat-on');
        }
    }
/**
     * Takes the value stored in the repeat pattern field and shows the weekday picker if required.
     */
Takes the value stored in the repeat pattern field and shows the weekday picker if required.
Takes the value stored in the repeat pattern field and shows the weekday picker if required .
applyPattern () {
        let _self = this,
            pattern = _self.$patternField.val();
        if (typeof _self.$endDateFieldContainer !== 'undefined') {
            if (pattern === '1day') {
                _self.$endDateFieldContainer.hide();
                _self.$endDateField
                    .val(moment(_self.originalEndDate, _self.dateFormatInternal).format(_self.localeFormat))
                    .attr('disabled', true)
                    .trigger('change')
                    .val('');
                _self.clndr.element.find('[data-day="' + _self.clndr.options.constraints.startDate + '"]').parent().addClass('selected');
            }
            else {
                _self.$endDateFieldContainer.show();
                _self.$endDateField.attr('disabled', false);
            }
        }
        if (pattern === 'weekly' || pattern === 'fortnight') {
            if (!_self.originalWeekdays.length) {
                let day = moment(_self.clndr.options.constraints.startDate, _self.dateFormatInternal).day(),
                    dayNo = day != 0 ? day : 7; 
                _self.$html.find('[name="ercal-weekdays"][value="' + dayNo + '"]').prop('checked', true);
            }
            _self.$weekdayPicker.show();
            _self.toggleWeekday();
        }
        else {
            _self.$html.find('[name="ercal-weekdays"]').prop('checked', false); 
            _self.$weekdayPicker.hide();
        }
        if (pattern !== 'weekly' && pattern !== 'fortnight') {
            _self.paintMonth(_self.clndr.month, 'clear');
            _self.setPattern(pattern);
            _self.paintMonth(_self.clndr.month, 'repeat-on');
        }
    }
applyPattern ( ) { let _self = this , pattern = _self . $patternField . val ( ) ; if ( typeof _self . $endDateFieldContainer !== 'undefined' ) { if ( pattern === '1day' ) { _self . $endDateFieldContainer . hide ( ) ; _self . $endDateField . val ( moment ( _self . originalEndDate , _self . dateFormatInternal ) . format ( _self . localeFormat ) ) . attr ( 'disabled' , true ) . trigger ( 'change' ) . val ( '' ) ; _self . clndr . element . find ( '[data-day="' + _self . clndr . options . constraints . startDate + '"]' ) . parent ( ) . addClass ( 'selected' ) ; } else { _self . $endDateFieldContainer . show ( ) ; _self . $endDateField . attr ( 'disabled' , false ) ; } } if ( pattern === 'weekly' || pattern === 'fortnight' ) { if ( ! _self . originalWeekdays . length ) { let day = moment ( _self . clndr . options . constraints . startDate , _self . dateFormatInternal ) . day ( ) , dayNo = day != 0 ? day : 7 ; _self . $html . find ( '[name="ercal-weekdays"][value="' + dayNo + '"]' ) . prop ( 'checked' , true ) ; } _self . $weekdayPicker . show ( ) ; _self . toggleWeekday ( ) ; } else { _self . $html . find ( '[name="ercal-weekdays"]' ) . prop ( 'checked' , false ) ; _self . $weekdayPicker . hide ( ) ; } if ( pattern !== 'weekly' && pattern !== 'fortnight' ) { _self . paintMonth ( _self . clndr . month , 'clear' ) ; _self . setPattern ( pattern ) ; _self . paintMonth ( _self . clndr . month , 'repeat-on' ) ; } }
Takes the value stored in the repeat pattern field and shows the weekday picker if required.
Takes the value stored in the repeat pattern field and shows the weekday picker if required .
// Toggle visibility of endDate field by showing/hiding it's container (based on Pulsar markup)  // reset selected state on startDate // Show the weekday picker if the pattern is `weekly/fortnightly` // Choose the weekday based on the startDate, only if weekdays have not been supplied on init() // If we're using the weekly pattern, this will have been painted appropriately before this point // Unpaint the currently stored pattern /*
                Set the new recurrence pattern

                Any dates in the datesToAdd / datesToDel collections will maintain their state
                and override the pattern
            */