Created
August 20, 2016 06:13
-
-
Save softtama/e9e0746e70c1d6a6d24ef6360ea11bdf to your computer and use it in GitHub Desktop.
Pikaday: Enable specific dates, disable the others
This file contains hidden or 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
| /** | |
| * Enable specific dates, disable the others | |
| * ----------------------------------------- | |
| * Using disableDayFn native function from Pikaday, | |
| * you can use array of dates (or in my code, array of date strings) | |
| * to make them the only dates that can be selected. | |
| * | |
| * Plugin: Pikaday (https://github.com/dbushell/Pikaday/) | |
| * | |
| * require jQuery | |
| * require moment.js | |
| * | |
| */ | |
| disableDayFn: function (date) { | |
| var enabled_dates = ["2016-08-20", "2016-08-22", "2016-08-30"]; // dates I only want to enabled. | |
| if ($.inArray(moment(date).format("YYYY-MM-DD"), enabled_dates) === -1) { | |
| return date; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment