Skip to content

Instantly share code, notes, and snippets.

@swapnilshrikhande
Created June 25, 2015 12:09
Show Gist options
  • Save swapnilshrikhande/251c97306176bee9391d to your computer and use it in GitHub Desktop.
Save swapnilshrikhande/251c97306176bee9391d to your computer and use it in GitHub Desktop.
jQuery Datepicker Day by Day disable dates
$('#nationalPicker').datepick({
onDate: nationalDays, showTrigger: '#calImg'});
var natDays = [[1, 26, 'au', 'Australia'], [2, 6, 'nz', 'New Zealand'],
[3, 17, 'ie', 'Ireland'], [4, 27, 'za', 'South Africa'],
[5, 25, 'ar', 'Argentina'], [6, 6, 'se', 'Sweden'],
[7, 4, 'us', 'United States'], [8, 17, 'id', 'Indonesia'],
[9, 7, 'br', 'Brazil'], [10, 1, 'cn', 'China'],
[11, 22, 'lb', 'Lebanon'], [12, 12, 'ke', 'Kenya']];
function nationalDays(date, inMonth) {
if (inMonth) {
for (i = 0; i < natDays.length; i++) {
if (date.getMonth() + 1 == natDays[i][0] &&
date.getDate() == natDays[i][1]) {
return {dateClass: natDays[i][2] + '_day',
selectable: false, title: natDays[i][3]};
}
}
}
return {};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment