JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" id="datepicker">
CSS
.ui-widget{
font-size: 0.7em;
}
td.highlight {
}
td.highlight > a {
background: #000!important;
color: #fff!important;
}
JavaScript
var dates = ['04/30/2010', '05/01/2010'];
$('#datepicker').datepicker({
numberOfMonths: [2, 2],
dateFormat: 'dd/mm/yy',
defaultDate: new Date('04/23/2010'), // this line is for testing
beforeShowDay: highlightDays
});
function highlightDays(date) {
for (var i = 0; i < dates.length; i++) {
console.log('entra en for');
console.log('dates[' + i + ']: ' + dates[i].toString());
console.log('date: ' + date.toString());
if (new Date(dates[i]).toString() == date.toString()) {
console.log('se cumple la condicion');
return [true, 'highlight'];
}
}
return [true, ''];
}