I would like to enable one specific date, which is a Sunday. Currently all Sundays are blocked.
I added this code at the end of 'product.liquid'.
{{ 'moment.min.js' | asset_url | script_tag }}
{{ 'pikaday.js' | asset_url | script_tag }}
{{ 'pikaday.jquery.js' | asset_url | script_tag }}
<script>
var picker = new Pikaday({
disableDayFn: function(date){
// Disable Sunday, Enable Specific Sunday
return date.getDay() === 0 && date.getDate() != "05/14/2017";
},
field: $('#del_date')[0],
format: 'MM/DD/YYYY',
onSelect: function() {
console.log(this.getMoment().format('Do MMMM YYYY'));
}
});
Check disableDayFn
to disable particular date inside Pikaday
Fiddle demo
var start_date = new Pikaday({
disableDayFn: function(date) {
var enabled_dates = ["05/14/2017"]; // dates I want to enabled.
if (date.getDay() === 0 && $.inArray(moment(date).format("MM/DD/YYYY"), enabled_dates) === -1) {
return date;
}
},
format: 'MM/DD/YYYY',
field: document.getElementById('start_date'),
})
;