2

I am using magento datepicker. i have an array dates which i want to disable that days in the magento datepicked.

for example 08/29/14 is holiday. so i want to make the date as disable so the user cannot select that.

Many Thanks

1 Answer 1

4

Assuming that this is a custom module, take a look at Magento calendar: Datepicker issue to disable days before today

Calendar.setup({
    inputField : 'date',
    ifFormat : '%e/%m/%Y',
    button : 'date_from_trig',
    align : 'Bl',
    singleClick : true,
    dateStatusFunc : disabledDate 
});

function disabledDate(date) {
    var today = new Date();
    return ([date1, date2, ..].indexOf(date.getDate()) !== -1) ? true : false;
};

Array#indexOf

8
  • i have 2 function one above disabling future dates and one disabling the past days.how can i call this 2 functions at a time. Aug 27, 2014 at 20:19
  • Did you try combining both function. if date not > or date not < return true else false Aug 27, 2014 at 20:36
  • i was checking like this dateStatusFunc : disabledDate , pastdays, giving me the err Aug 28, 2014 at 3:35
  • where this code will going to place? I have scenario for purchase order date. I want to disable past date disable in magento 2. what i have to do? May 2, 2017 at 7:17
  • @PramodKharade ... for Magento 1.x or 2.x? May 2, 2017 at 23:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.