Get dateinput max and min date

869 views Asked by At

I'm using dateinput() from the jQuery TOOLS UI library, and I set min and max dates.

However, I want to get those values after setting them. How can achieve this?

1

There are 1 answers

0
K K On

You can try this:

$(":date").dateinput({
    format: 'dddd dd, mmmm yyyy', // the format displayed for the user
    selectors: true, // whether month/year dropdowns are shown
    min: -100, // min selectable day (100 days backwards)
    max: 100, // max selectable day (100 days onwards)
    offset: [10, 20], // tweak the position of the calendar
    speed: 'fast', // calendar reveal speed
    firstDay: 1, // which day starts a week. 0 = sunday, 1 = monday etc..
    change: function (a) {
        console.log($(this)[0].getConf().min);//min value
        console.log($(this)[0].getConf().max);//max value
    }
});

HTML:

<input type="date" name="date1" value="Today" />
<input type="date" name="date2" value="10 days from now" min="2010-03-01" max="2012-01-01" class="one" />
<input type="date" name="date3" value="15" min="-25" max="25" data-value="15" />

Demo: http://jsfiddle.net/GCu2D/159/

Apart from change function, it also has onShow and onHide just in case if you want to use min max later or on show.