1

I want to allow customer to choose dates after 1 week from current date.

Like as today date is 15 Feb 2019 so customer can select dates from 22 feb 2019.

I did change js for calendar by adding below code .

var calendarSetupObject = {
                inputField  : "' . $this->getId() . '",
                ifFormat    : "' . $displayFormat . '",
                showsTime   : "' . ($this->getTime() ? 'true' : 'false') . '",
                button      : "' . $this->getId() . '_trig",
                align       : "Bl",
                singleClick : true,
                 disableFunc: function(date) {
                     var now = new Date();

                if(date.getFullYear()   <   now.getFullYear())  { return true; }
                if(date.getFullYear()   ==  now.getFullYear())  { if(date.getMonth()    <   now.getMonth()) { return true; } }
                if(date.getMonth()      ==  now.getMonth())     { if(date.getDate()     <   now.getDate()+7)  { return true; } }
                 }

            } 

so now its displaying same calendar what i want but its not allowing me select date 22 feb now .

enter image description here

0

Try this

disableFunc: function(date) {
            var now = new Date();
            var one_day=1000*60*60*24;
            // disable all previous dates...
            if(date.getFullYear()   <   now.getFullYear())  { return true; }
            if(date.getFullYear()   ==  now.getFullYear())  { if(date.getMonth()    <   now.getMonth()) { return true; } }
            if(date.getMonth()      ==  now.getMonth())     { if(date.getDate()     <=   now.getDate())  { return true; } }
             }
            // disable next 7 days...
            if(((date.getTime() - now.getTime())/one_day) <= 7){ return true; }

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.