sathish kumar
sathish kumar

Reputation: 936

datetimepicker display format in jquery

I have 2 datepicker startDate and endDate. If I opn datepicker it has defaultly showing the today's date fo both startDate and endDate.

For example, if I select "25-10-2016" from startDate, the endDate should be start from "25-10-2016". Not todays date.

enter image description here enter image description here

Please look at this image,the active blue color date. Defaultly it has showing today's date for both startDate and endDate field.

The selected startDate as not todays's date. I want that startdate as endDate. Please help me how can I do this.

Upvotes: 0

Views: 57

Answers (1)

Mohit Dagar
Mohit Dagar

Reputation: 570

You can set the minimum date of EndDate like as below code. After that endate date will always greater or equal to startdate.

 $("startdate").datepicker({
        onSelect: function( selectedDate ) {
            if(this.id == 'StartDate') {
                var minDate = selectedDate + 1;
                $('#to').datepicker("option", "minDate", minDate);
            }
        }
   });

Upvotes: 0

Related Questions