Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to limit datepicker's max date to today? [duplicate]

The questions is in the Title. I have two datepickers, from and to. I want to limit the from datepicker to the current date. How do I do that? Thanks in advance!

like image 815
Dragan Avatar asked Nov 04 '11 14:11

Dragan


1 Answers

Use the maxDate options : http://jqueryui.com/demos/datepicker/#option-maxDate

Set a maximum 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. '+1m +1w'), or null for no limit.

For example : $( ".selector" ).datepicker( "option", "maxDate", new Date() );

like image 55
Guillaume Cisco Avatar answered Nov 09 '22 05:11

Guillaume Cisco