Is it possible to disable dates when I use I want to disable current date for one scenario and future dates for other scenario. How should I disable the dates?
相关问题
- Date with SimpleDateFormat in Java
- VBA local timezone adjustment
- How to resize datepicker text programmatically
- How do you use java stream api to convert list of
- JSpinner.DateEditor in Java Not Respecting TimeZon
相关文章
- HTML5 control
- MYSQL: How can I find 'last monday's date&
- Woocommerce update shipping methods in checkout vi
- Calculate number of working days in a month [dupli
- jQuery UI datepicker - Trying to capture click eve
- Get file created date in node
- Temporal Extraction (i.e. Extract date/time entiti
- Postgres String to Date EXAMPLE 10Apr77 to 10/04/1
You could use this to disable future dates :
Inside you
document.ready
function, placeand in form
Here is the working jFiddle Demo
HTML datepicker (
<input type=date>
) supportsmin
/max
attribute, but it is not widely supported.At the meantime you may consider using bootstrap-datepicker, v1.2.0 is on github.
References:
W3C spec
You can add a
min
ormax
attribute to theinput type=date
. The date must be in ISO format (yyyy-mm-dd). This is supported in many mobile browsers and current versions of Chrome, although users can manually enter an invalid date without using the datepicker.The
min
andmax
attributes must be a full date; there's no way to specify "today" or "+0
". To do that, you'll need to use JavaScript or a server-side language:http://jsfiddle.net/mblase75/kz7d2/
Ruling out only today, while allowing past or future dates, is not an option with here. However, if you meant you want tomorrow to be the
min
date (blanking out today and all past dates), see this question to incrementtoday
by one day.As in all other cases involving HTML forms, you should always validate the field server-side regardless of how you constrain it client-side.