onClose in datepicker?

onClose in datepicker?


The docs for the onClose event in datepicker say "The function
receives the selected date as a Date and the datepicker instance as
parameters." However, I can't seem to use this as a Date object:
$('#date_pick').datepicker( {
                 onClose: function(date) {
                     var m = date.getMonth();
                     alert(m); } } );
This throws a "date.getMonth is not a function" error.
How am I meant to use this?
Thanks.
(This is a much-shortened version of a question I sent last week.)