Reputation: 1402
I'm trying to set a range in my datepicker
with an 18 year minimum age. So when you click it it shouldn't say 2015 but it should be the year 2015 - 18.
My input:
<input class="form-control" id="BIRTHDAY" data-type="date" data-required="true"
name="BIRTHDAY" data-min="~(FORMATDATETIME(DATEADD('yyyy', -100, GETDATE()),'%d-%m-%Y'))~"
data-max="~(FORMATDATETIME(DATEADD('yyyy', -18, GETDATE()),'%d-%m-%Y'))~" value="~BIRTHDAY~"
maxlength="10" data-sim-mask="date">
Notice:
data-min
does work, the minimum is 1915 however the data-max
doesn't work. It still shows 2015. There is a validation that says you have to be 18 years but I want default settings already to be correct.
Datepicker I'm using https://eonasdan.github.io/bootstrap-datetimepicker/
Upvotes: 2
Views: 2349
Reputation: 3429
You did not include the datepicker library
so add
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js"></script>
to your <head>
Upvotes: 2
Reputation: 3336
UPDATED using javascript you could do the following. Jsfiddle example
$('#BIRTHDAY').datetimepicker({
minDate: '-2015/9/15', //set min date
maxDate: '2015/9/28' //set max date
});
Upvotes: 1