Skip to main content
edited title
Link
isherwood
  • 60.5k
  • 16
  • 119
  • 164

jquery UI how How to set third min-max relationship for jQuery UI datepicker

Source Link

jquery UI how to set third min-max relationship for datepicker

In my application I'm using jquery datepicker for 3 date inputs, "receiveDate", "startDate" and "endDate". I already set my startDate always earlier than endDate by:

$("#WL_StartDate").attr("autocomplete", "off");
        $(function () {
            $("#WL_StartDate").datepicker({
                changeMonth: true,
                changeYear: true,
                onSelect: function (selected) {
                    $("#WL_EndDate").datepicker("option", "minDate", selected)
                },
            });
        });

        $("#WL_EndDate").attr("autocomplete", "off");
        $(function () {
            $("#WL_EndDate").datepicker({
                changeMonth: true,
                changeYear: true,
                onSelect: function (selected) {
                    $("#WL_StartDate").datepicker("option", "maxDate", selected)
                },
            });
        });

And it works well

Now I want my "receiveDate" also always earlier than my "startDate", I tried:

$("#ReceivedDate").attr("autocomplete", "off");
        $(function () {
            $("#ReceivedDate").datepicker({                   
                maxDate: '0',
                changeMonth: true,
                changeYear: true,
                onSelect: function (selected) {
                    $("#WL_StartDate").datepicker("option", "minDate", selected)
                },
            });
            });
        });

but not working, can anyone give me some ideas? Thank you!