JSFiddle - React, Tailwind, and code Playground

by ecoologic

HTML

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css">
<div data-only="5" class="datepicker"></div>

CoffeeScript

class DateDisabler

  constructor: (@only) ->

  beforeShowDay: (date) =>
    if @only == date.getDate()
      [true, 'available', 'This date is a good date']
    else
      [false, 'unavailable', 'This date is NOT good']

jQuery ->
  $('.datepicker').each (i, e) ->
    dates = $(e).data('only')
    disabler = new DateDisabler dates
    $(e).datepicker({beforeShowDay: disabler.beforeShowDay})