JSFiddle - React, Tailwind, and code Playground
by ataylor
HTML
<input type="text" id="dp" />
CSS
article, aside, figure, footer, header, hgroup, menu, nav, section {
display: block;
}
JavaScript
/* create an array of days which need to be disabled */
var disabledDays = ["2-21-2010", "2-24-2010", "2-27-2010", "2-28-2010", "3-3-2010", "3-17-2010", "4-2-2010", "4-3-2010", "4-4-2010", "4-5-2010"];
function getHolidays() {
var currentDate = new Date(),
nextYear = new Date();
nextYear.setMonth(nextYear.getMonth() + 12);
currentDate = $.datepicker.formatDate('dd-mm-yy', currentDate);
nextYearDate = $.datepicker.formatDate('dd-mm-yy', nextYear);
var jsonURL = "http://kayaposoft.com/enrico/json/v1.0/?action=getPublicHolidaysForDateRange&fromDate=" + currentDate + "&toDate=" + nextYearDate + "&country=usa®ion=Hawaii";
$.ajax({
url: jsonURL,
dataType: 'json',
success: function (data) {
var holidays = [];
$.each(data, function (key, val) {
console.log("key: " + key);
console.log("val: " + val);
});
return data;
}
});
};
getHolidays();
/*
$("#dp").datepicker({
maxDate: "+12m",
minDate: "+0d",
dateFormat: "mm-dd-yyyy",
constrainInput: true,
beforeShowDay: getHolidays(date)
});
*/