Oh snap! You are using an old version of browser. Update your browser to get new awesome features. Click for more details.

Magento Admin how to disable past days, current date in datepicker

Hi Friend's

Disable past and current date selection in admin form edit/add action

Open your form.php file and add this code


$nextdate = $fieldset->addField('next_date'.$counter, 'date',
        'name'      => 'upcoming_date',
        'label'     => 'Upcomng Date',
        'class'     => 'required-entry validate-date validate-date-range date-range-custom_theme-from',
        'required'  => true,
        'image'     => $this->getSkinUrl('images/grid-cal.gif'),
        'format'    => 'YYYY-MM-dd'
$nextdate->setAfterElementHtml("<p>Date format is <strong style='color: #FF0000;'>YYYY</strong>/<strong style='color: #FF0000;'>MM</strong>/<strong style='color: #FF0000;'>DD</strong></p>
<script type=\"text/javascript\">
    inputField: 'upcoming_date',
        ifFormat: '%Y-%m-%d',
        showsTime: false,
        button: 'upcoming_date_trig',
        align: 'Bl',
        singleClick : true,
        disableFunc: function(date)  {
            var now = new Date();
            //If you want to disable current date so remove below comment
            //now.setDate(now.getDate() + 1);
            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; } }

Now Flush Magento Cache and refresh page

Hope this information is helpful to you :)


  1. Superb. I really enjoyed very much with this article here. Really it is an amazing article I had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent article.thank you for sharing such a great blog with us. expecting for your.
    Digital Marketing Company in India
    seo Company in India

  2. very very amazing explaintion....many things gather about yourself...yes realy i enjoy it
    Digital Marketing company

    in Chennai