Skip to content

Instantly share code, notes, and snippets.

@nmenag
Created January 5, 2016 15:08
Show Gist options
  • Select an option

  • Save nmenag/ae62b127462eebe25188 to your computer and use it in GitHub Desktop.

Select an option

Save nmenag/ae62b127462eebe25188 to your computer and use it in GitHub Desktop.
var holidays =[]
//holiday model ruby, table that save all the holidays federal
holidays = "<%= Holiday.all.map{ |h| h.date.strftime("%Y-%m-%d") } %>";
/*example "2015-10-12", "2015-11-02", "2015-11-16", "2015-12-08", "2015-12-25", "2016-01-01",
"2016-01-11", "2016-03-21", "2016-03-24", "2016-03-25", "2016-05-01", "2016-05-09", "2016-05-30",
"2016-06-06", "2016-07-04", "2016-07-20", "2016-08-07", "2016-08-15", "2016-10-17", "2016-11-07",
"2016-11-14", "2016-12-08", "2016-12-25"]*/
$('.date').datepicker({
startDate: start_date
language: "es",
autoclose: true,
daysOfWeekDisabled: [0,6], //disable weekend
beforeShowDay:function(Date){
var curr_date = Date.toJSON().substring(0,10);
if (holidays.indexOf(curr_date)>-1) return false;
}//Disable days holidays federal
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment