1

In backend i added date and time

<script type="text/javascript">
    // <![CDATA[
    Calendar.setup({
    inputField : 'shipping_pickup_at_store_date',
    ifFormat : '%d-%m-%Y',
    showsTime: false,
    button : 'shipping_pickup_at_store_date',
    singleClick : true,
    disableFunc: function(date) {
    //disable previous day in datepicker
        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())
            {
                return true;
            }
        }
    },
    });
    // ]]>
</script>

in DataPicker it shows date and time if i select in my textbox it will show only data how i show time

Also I can't able to choose current month date

  • Did you get solution for your problem? @kothari – Jaimin Sutariya Apr 18 '17 at 16:02
0

Use only below code, It will add time and allow to select dates from current month.

<script type="text/javascript">
    // <![CDATA[
    Calendar.setup({
    inputField : 'shipping_pickup_at_store_date',
    ifFormat : '%d-%m-%Y %H:%M',
    showsTime: true,
    button : 'shipping_pickup_at_store_date',
    singleClick : true,
    });
    // ]]>
</script>
| improve this answer | |
  • it's come like this 19-05-2017 %h:05 – Magento 2 Apr 9 '17 at 19:43
  • i can't able to select current month – Magento 2 Apr 9 '17 at 20:36
  • Please check updated code – Jaimin Sutariya Apr 10 '17 at 2:36

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.