Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove minDate/maxDate limits in jQuery UI Datepicker

A simple issue, but I can't seem to find the answer.

I've limited the date range in jQuery Datepicker:

$( "#MyDatepicker" ).datepicker( "option", "minDate", new Date())

Is there a way to remove all restrictions for date range?

like image 818
Earl Grey Avatar asked Oct 04 '12 11:10

Earl Grey


People also ask

What is minDate and MaxDate in jQuery Datepicker?

If you like to restrict access of users to select a date within a range then there is minDate and maxDate options are available in jQuery UI. Using this you can set the date range of the Datepicker. After defining these options the other days will be disabled which are not in a defined range.

How do I change my Datepicker size?

By default DatePicker has standard height and width (height: '30px' and width: '143px'). You can change this height and width by using height and width property respectively.

How do I limit Datepicker?

You can restrict the users from selecting a date within the particular range by specifying MinDate and MaxDate properties. The default value of MinDate property is 1/1/1920 and MaxDate property is 12/31/2120 . Dates that appears outside the minimum and maximum date range will be disabled (blackout).

How do I restrict date range of a jQuery Datepicker by giving two dates?

To implement this, write code in jQuery UI Datepicker "onSelect" event which gets called when date is selected. $(document). ready(function () { var daysToAdd = 4; $("#txtFromDate"). datepicker({ onSelect: function (selected) { var dtMax = new Date(selected); dtMax.


1 Answers

Try this $( "#MyDatepicker" ).datepicker( "option", "minDate", null).

From JQuery documentation about datepicker minDate option

Set a minimum selectable date via a Date object or as a string in the current dateFormat, or a number of days from today (e.g. +7) or a string of values and periods ('y' for years, 'm' for months, 'w' for weeks, 'd' for days, e.g. '-1y -1m'), or null for no limit.

like image 50
Aleksandr M Avatar answered Sep 20 '22 15:09

Aleksandr M