I have a date picker:
<link rel="stylesheet" type="text/css" href="/css/jquery-ui-1.8.17.custom.css"/>
<script src="/js/jquery-1.7.1.min.js"></script>
<script src="/js/jquery-ui-1.8.17.min.js"></script>
<div id="pickerdiv"></div>
<script>
$(document).ready(function(){
$('#pickerdiv').datepicker({
beforeShowDay: function(date){
//some code
return [true, ''];
}
});
});
</script>
The problem is that date picker always sends in an invalid date. Today is feb 29th and the date it sends is always Jan 29th. In addition chrome’s debugger says its type is “Invalid Date”. I’ve also tried switching it from a div to an input with the same result.
Is there any way to get a valid date sent into my beforeShowDay function? Thanks.
Seems to work fine for me: http://jsfiddle.net/y5FbY/
Watch the console output.
It should be noted that this is called as it renders each day onto the calendar, as well as some non-visible days. It starts one month prior to today (Jan 29th) and goes until the end of the current week, I think (Mar 3rd). You are simply seeing the first call of many.
That is my guess, but you may be seeing something else. It’s difficult to say without a working example of your situation.