Is there a Javascript or some library that would create a datepicker for a webpage (similar to Jquery UI DatePicker that would only allow certain dates to be clickable and highlighted.
For example on server side, I could specify a array of days to enable to be selected.
The Datepicker beforeShowDay() event is intended for exactly this purpose. Here’s an example where the set of allowed dates is relatively small for purposes of illustration. Depending on how many dates you have and how they are chosen, you could instead write a method that programmatically selected dates (say by ignoring weekends, the 1st and 15th of every month, etc). Or you could combine both techniques, say remove weekends and a fixed list of holidays.
The return values are
Note that the date variable given in the callback is an instance of a Date object representing the given day, not a text version of that date in the specified format. So for instance, you could generate the list of allowable dates in one format while displaying dates in the datepicker in a different format (e.g. so you wouldn’t have to transform dates from a DB when generating the page).
See also Can the jQuery UI Datepicker be made to disable Saturdays and Sundays (and holidays)?