0

我在 Angular 8 项目中使用 ngx-daterangepicker-material 作为日期选择器。我需要一个一周的范围选择器,用户不能选择向前一周,并且不能多于或少于一周的范围。此外,我必须在单个日历中制作此范围选择器。单个日历仅适用于属性singleDatePicker="true"

我的代码:

<input (datesUpdated)="selectedChange($event)" [(ngModel)]="selected"
       [autoApply]="options.autoApply"
       [closeOnAutoApply]="options.closeOnAutoApply"
       [customRangeDirection]="options.customRangeDirection"
       [linkedCalendars]="options.linkedCalendars"
       [lockStartDate]="options.lockStartDate"
       [maxDate]="maxDate"
       [showCancel]="options.showCancel"
       [showClearButton]="options.showClearButton"
       [showISOWeekNumbers]="options.showISOWeekNumbers"
       [showWeekNumbers]="options.showWeekNumbers" applyLabel="Okay"
       singleDatePicker="true"
       autocomplete="on"
       dateLimit="6"
       emptyWeekRowClass="empty-week"
       firstDayOfNextMonthClass="first-next-day"
       firstMonthDayClass="first-day" id="weekpicker"
       lastDayOfPreviousMonthClass="last-previous-day"
       lastMonthDayClass="last-day" matInput name="options"
       ngxDaterangepickerMd
       opens="left" type="radio">

我的选择:

options: any = {
    autoApply: false,
    alwaysShowCalendars: false,
    showCancel: false,
    showClearButton: false,
    linkedCalendars: true,
    singleDatePicker: true,
    showWeekNumbers: false,
    showISOWeekNumbers: false,
    customRangeDirection: false,
    lockStartDate: false,
    closeOnAutoApply: true,
};
maxDate = moment().max(moment().add(1, 'd'));
minDate = moment().startOf('year');

我尝试过使用文档中的不同选项,但未能实现。

4

0 回答 0