Skip to content

Instantly share code, notes, and snippets.

@chrismademe
Last active April 2, 2019 08:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrismademe/881a45d42fa74b56f2fb329eef27035c to your computer and use it in GitHub Desktop.
Save chrismademe/881a45d42fa74b56f2fb329eef27035c to your computer and use it in GitHub Desktop.
Disable days on Pikaday instance
var picker = new Pikaday({
field: document.getElementById('datpicker'),
minDate: moment().toDate(), // Today
disableDayFn: function(date) {
var currentDate, today, yearFromNow, dateFormat;
// Set Date Format
dateFormat = 'YYYY-MM-DD';
// Create Moment Objects
currentDate = moment(date);
today = moment(new Date());
// Disable today
// Use Moment methods to check dates etc.
if ( currentDate.format(dateFormat) == today.format(dateFormat) ) {
return true;
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment