min max date range selection in date range picker
I am using Date Range Picker
Codes are here:
<input type="text" name="sample" id="sample" class="date_css" value="Select a date" />
Query is here:
<script type="text/javascript">
$(function(){
$('#sample').daterangepicker({
arrows:true,
dateFormat: 'd-M-yy',
rangeSplitter: 'to',
datepickerOptions: {
changeMon开发者_如何学JAVAth: true,
changeYear: true,
minDate: new Date("01/01/2011") //Account created date
},
});
});
</script>
Question: datepickerOptions
Options are similar to same option using in datepicker in jquery ui. How can i use min max date selection while user selects date in particular range. (ie How to use onSelect
Option within datepickerOptions
and to restrict a range of selection)
Help Me
Thank in Advance...
See datepicker min max and datepicker date-range. The part you want is i think:
onSelect: function( selectedDate ) {
var option = this.id == "from" ? "minDate" : "maxDate",
instance = $( this ).data( "datepicker" ),
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings );
dates.not( this ).datepicker( "option", option, date );
}
Then you combine it with "minDate" and "maxDate" options.
精彩评论