vitalets/combodate

No Min Date/Max Date options?

Opened this issue ยท 4 comments

Hi.

I want to configure combodate to show dates only from specified range of date (min date to max date). But there's only minYear and maxYear options. If you don't mind please add this feature.

Thanks.

๐Ÿ‘ or at least add maxMonth maxDay so it can be done using other methods like.

+1 on this

inside combodate.js add 2 parameter minDate and maxDate

$.fn.combodate.defaults = {
         //in this format value stored in original input
        format: 'DD-MM-YYYY HH:mm',      
        //in this format items in dropdowns are displayed
        template: 'D / MMM / YYYY   H : mm',
        //initial value, can be `new Date()`    
        value: null,                       
        minYear: 1970,
        maxYear: 2015,
        minDate: 1,//add minDate
        maxDate: 31,//add maxDate
        yearDescending: true,
        minuteStep: 5,
        secondStep: 1,
        firstItem: 'empty', //'name', 'empty', 'none'
        errorClass: null,
        roundTime: true ,//whether to round minutes and seconds if step >// 1
        // smartDays: true
    };

then change fillDay function for loop in combodate.js

fillDay: function() {
            var items = this.initItems('d'), name, i,
                twoDigit = this.options.template.indexOf('DD') !== -1;



            for(i=this.options.minDate; i<=this.options.maxDate; i++) {//change here like this
                name = twoDigit ? this.leadZero(i) : i;
                items.push([i, name]);
            }
            return items;        
        },

and use data-min-date and data-max-date

<input type="text" class="combodate-time" data-format="YYYY-MM-DD" data-template="DD/MM/YYYY" name="push_date" data-min-date="3" data-max-date="10" value="2018-01-01">

you can add min-month and max-month like this method.

Hi Guys,
Is there any way to set Max date should be today's date?
it can be apply on MM, DD and YYYY all.