AnsweredAssumed Answered

minDate and maxDate not working sugar datepicker

Question asked by sidhu sidhu on Sep 22, 2017
Latest reply on Sep 26, 2017 by André Lopes

Hi All,

 

         I was trying this work around to restrict the dates in date picker using the minDate and maxDate options so that user can be restricted in selecting dates.

 

I have tried various options but with no success.

 

André Lopes hats Francesca Shiekh Angel Magana

 

 

in File /custom/clients/base/fields/date/date.js

 

 

 

   _setupDatePicker: function() {
        var $field = this.$(this.fieldTag),
            userDateFormat = this.getUserDateFormat(),//mm/dd/yyyy
            options = {
                format: app.date.toDatepickerFormat(userDateFormat),
                languageDictionary: this._patchPickerMeta(),
                weekStart: parseInt(app.user.getPreference('first_day_of_week'), 10),
                minDate:"09/22/2017",//added by me
                maxDate:"09/30/2017",//added by me
            };
        var appendToTarget = this._getAppendToTarget();
        if (appendToTarget) {
            options['appendTo'] = appendToTarget;
        }
        $field.datepicker(options);
        this._hasDatePicker = true;
    },

 


Regards

Sidhu

Outcomes