Dilto.Wilson
Dilto.Wilson

Reputation: 41

How to disable sundays from jquery datetimepicker?

I am working on jquery datetimepicker and I want to disable Sundays from datetimepicker how can I do that?

This is my jquery code:

 $(".datetimepicker").datetimepicker({ format: 'm-d-Y H:i', defaultDate: new Date(),
    minDate: '-1970/01/6',
    maxDate: 0,
    closeOnDateSelect:true

    });

Upvotes: 0

Views: 6561

Answers (2)

Rahul kumar Ranjan
Rahul kumar Ranjan

Reputation: 11

First of all update your datetimepicker library .

https://plugins.jquery.com/datetimepicker/

then click on 'download now' then extract Zip Folder then open folder click build then select jquery.datetimepicker.full.js file and jquery.datetimepicker.min.css copy both and past on your project according to use library path.

Then use this code in jQuery...

jQuery('#Your Id').datetimepicker({
        format : 'd/m/Y',
        changeMonth : false,
        changeYear : false,
        timepicker : false,
        closeOnDateSelect : true,
        scrollInput : false,
        minDate : 0,
        disabledWeekDays:[0]
});

Upvotes: 1

Raviteja
Raviteja

Reputation: 3479

Add this attribute daysOfWeekDisabled: [0], to the JavaScript.0 inside the array brackets indicates Sunday.If you want to disable any other days of a week, include inside the array as [0,6] for Sundays and Saturdays.

Upvotes: 3

Related Questions