jquery ui date picker limit to Sundays

后端 未结 2 2069
小蘑菇
小蘑菇 2021-01-01 04:04

I have looked at some of the answers here to this type of question but could not get them to work how I needed them to. I need to have my jQuery UI datepicker only allow Sun

2条回答
  •  不思量自难忘°
    2021-01-01 04:34

    // Enable Sunday only
    $("#datepickerID").datepicker({
        dateFormat: 'dd-mm-yy',
        minDate: 1,
        beforeShowDay: enableSUNDAYS
    });
    // Custom function to enable SUNDAY only in jquery calender
    function enableSUNDAYS(date) {
        var day = date.getDay();
        return [(day == 0), ''];
    }
    

提交回复
热议问题