Datepicker noweekend和日期范围

时间:2017-02-15 06:41:48

标签: datepicker

我尝试禁用假期和周末的日期,但这不起作用 我的代码:

public static class HasExpectedException {
    @Rule
    public final ExpectedException thrown = ExpectedException.none();

    @Test
    public void throwsNullPointerException() {
            thrown.expect(NullPointerException.class);
            throw new NullPointerException();
    }
}

日期假期被禁用,但不是周末!

我想在周末度过难关。 THX

我找到了解决方案

$(function() {
   $('.thing12DatePicker').datepicker(
        { 
          beforeShowDay: function (date) {
                    var startDate = "2017-06-17", 
                    endDate = "2017-06-21",  
                    dateRange = [];           
                            for (var d = new Date(startDate); d <= new Date(endDate); d.setDate(d.getDate() + 1)) {
                    dateRange.push($.datepicker.formatDate('yy-mm-dd', d)&& $.datepicker.noWeekends);
                }
                                var dateString = jQuery.datepicker.formatDate('yy-mm-dd', date);
                                return [dateRange.indexOf(dateString) == -1];
                        }

             });
  });

0 个答案:

没有答案