Last active
April 2, 2019 08:18
-
-
Save chrismademe/881a45d42fa74b56f2fb329eef27035c to your computer and use it in GitHub Desktop.
Disable days on Pikaday instance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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