I currently am using DateRangePicker by and have the following code for my project :
<form name="calform" action="res_info.php">
<div>Checkout<input type="text" name="checkout"/></div>
<script type="text/javascript">
$(function() {
isInvalidDate: function(date) {
if (date.format('YYYY-M-D') == '2017-11-12') {
return true;
}
}
$('input[name="checkout"]').daterangepicker({
singleDatePicker: true,
"locale": {
format: 'YYYY-M-D'
}
},
function(start, end, label) {
var years = moment().diff(start, 'years');
});
$('.calendar.right').show();
});
</script>
<div> <input type="submit" value="Submit"></div>
</form>
But for some reason , isInvalidDate
function doesn't work at all. Please Help.
I currently am using DateRangePicker by http://www.daterangepicker. and have the following code for my project :
<form name="calform" action="res_info.php">
<div>Checkout<input type="text" name="checkout"/></div>
<script type="text/javascript">
$(function() {
isInvalidDate: function(date) {
if (date.format('YYYY-M-D') == '2017-11-12') {
return true;
}
}
$('input[name="checkout"]').daterangepicker({
singleDatePicker: true,
"locale": {
format: 'YYYY-M-D'
}
},
function(start, end, label) {
var years = moment().diff(start, 'years');
});
$('.calendar.right').show();
});
</script>
<div> <input type="submit" value="Submit"></div>
</form>
But for some reason , isInvalidDate
function doesn't work at all. Please Help.
-
Where or how are you trying to use the function
isInvalidDate
? – Amit Joshi Commented Aug 7, 2017 at 16:05
1 Answer
Reset to default 8isInvalidDate appears to be a method of daterangepicker
. As your code currently goes, that method is outside of scope of the daterangepicker
object/function.
You'll need to place it inside like so:
$('input[name="checkout"]').daterangepicker({
singleDatePicker: true,
"locale": {
format: 'YYYY-M-D'
},
isInvalidDate: function(date) {
if (date.format('YYYY-M-D') == '2017-11-12') {
return true;
}
}
});
Additionally, it looks like the code will still be malformed. You have a, what i would consider random, function in the daterangepicker
object. I'd read the documentation, to get a better understanding of the use of that function.
http://www.daterangepicker./#options
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1743884838a4523840.html
评论列表(0条)