подсветка нескольких дат в календаре jquery datepicker
Помогите пожалуйста разобраться.
console.log(eventDates);
и
console.log(eventDates2);
идентичны.
Вопрос следующий:
eventDates - подвечивает
eventDates2 - НЕ ПОДСВЕЧИВАЕТ
Почему?!
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" />
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
Date: <input type="text" id="datepicker">
<script type="text/javascript">
$( function() {
// An array of dates
let eventDates = {};
eventDates[ new Date( '06/07/2022' )] = new Date( '06/07/2022' );
eventDates[ new Date( '06/18/2022' )] = new Date( '06/18/2022' );
eventDates[ new Date( '06/23/2022' )] = new Date( '06/23/2022' );
let eventDates2 = {};
eventDates2[ new Date( '2022-06-07' )] = new Date( '2022-06-07' );
eventDates2[ new Date( '2022-06-18' )] = new Date( '2022-06-18' );
eventDates2[ new Date( '2022-06-23' )] = new Date( '2022-06-23' );
console.log(eventDates);
console.log(eventDates2);
// datepicker
$('#datepicker').datepicker({
beforeShowDay: function( date ) {
let highlight = eventDates[date];
if( highlight ) {
return [true, "event", 'Tooltip text'];
} else {
return [true, '', ''];
}
},
showOn: 'button',
buttonText: "day",
dateFormat: 'dd/mm/yy',
});
});
</script>