Disable single date in p-calendar

こ雲淡風輕ζ 提交于 2019-12-13 04:05:46

问题


I have a calender and I want to disiable a certain date eg 10/7/2018, I am using p-calendar

Here is what I have done so far

<p-calendar formControlName="date" [inline]="true" [disabledDays]="[10]"  [minDate]="minimumDate" tabindex="0">
        <ng-template pTemplate="date" let-date>
            <span [ngStyle]="{backgroundColor: (date.day ==10) ? '#7cc67c' : 'inherit'}"   style="border-radius:50%">{{date.day}}</span>
        </ng-template>
    </p-calendar>

This does not work ,

What is wrong with my code?


回答1:


You're using [disabledDays], where each value represents a day of the week, so any value > 6 is invalid. You want disabledDates instead, which should be an array of Date objects.

There should be more info in the documentation that you linked to.



来源:https://stackoverflow.com/questions/51226638/disable-single-date-in-p-calendar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!