Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable future dates in jQuery UI Datepicker

Is it possible to disable future date from today?

Let say today is 23/10/2010, so 24/10/2010 onwards are disabled.

Sorry I am very new in jQuery and JavaScript.

like image 616
cicakman Avatar asked Oct 23 '10 06:10

cicakman


People also ask

How do I turn off future date in calendar?

In the calendar widget their is an option to select max date, in which you can set the value as CurrDate(). So that future dates in the calendar would be disabled.

How do you turn off future date in date range picker?

// date range picker $('. date_input'). daterangepicker({ autoUpdateInput: false, locale: { cancelLabel: 'Clear', format: 'DD-MM-YY' } });

How to disable future dates in datepicker in mvc?

If you want to future date disable from today use today. getFullYear() - 10 in order to disable 10 years before which means disable from 2008.


2 Answers

Yes, indeed. The datepicker has the maxdate property that you can set when you initialize it.

Here's the codez

$("#datepicker").datepicker({ maxDate: new Date, minDate: new Date(2007, 6, 12) }); 
like image 168
Cyril Gupta Avatar answered Oct 27 '22 15:10

Cyril Gupta


$(function() { $("#datepicker").datepicker({  maxDate: '0'}); }); 
like image 22
ArK Avatar answered Oct 27 '22 15:10

ArK