JSFiddle - React, Tailwind, and code Playground
HTML
<div data-only="5" class="datepicker">foo</div>
JavaScript
(function() {
var DateDisabler;
DateDisabler = (function() {
function DateDisabler(only) {
this.only = only;
}
DateDisabler.prototype.beforeShowDay = function(date) {
console.log(this.only);
if (parseInt(this.only) === date.getDate()) {
return [true, 'available', 'This date is a good date'];
} else {
return [false, 'unavailable', 'This date is NOT good'];
}
};
return DateDisabler;
})();
jQuery(function() {
return $('.datepicker').each(function(i, e) {
var dates, disabler;
dates = $(e).data('only');
disabler = new DateDisabler(dates);
return $(e).datepicker({
beforeShowDay: disabler.beforeShowDay
});
});
});
}).call(this);
jQuery(function() {
return $('.datepicker').each(function(i, e) {
var dates, disabler;
dates = $(e).data('only');
disabler = new DateDisabler(dates);
return $(e).datepicker({
beforeShowDay: disabler.beforeShowDay
});
});
});
}).call(this);