mattlewis92 / angular-calendar

A flexible calendar component for angular 15.0+ that can display events on a month, week or day view.
https://mattlewis-github.com/angular-calendar/
MIT License
2.71k stars 863 forks source link

Disable day cells in montly view #1643

Closed massimoadriaens closed 1 year ago

massimoadriaens commented 1 year ago

Is your feature request related to a problem? Please describe

I am trying to disable day cells before/after a given date.

Describe the solution you'd like

Being able to prevent click events/disable day cells in month views

Describe your use case for implementing this feature

Only select dates starting from today or a date provided by the user. Avoid weekends being selected while they still need to be shown

Additional context

/

matts-bot[bot] commented 1 year ago

Thanks so much for opening an issue! If you'd like to support this project, then please consider sponsoring me

n3verlate commented 1 year ago

Yes, you can In your typescript file :

beforeMonthViewRender(renderEvent: CalendarMonthViewBeforeRenderEvent): void {
  renderEvent.body.forEach((day) => {
     day.isPast = true;
  }
}

isPast property make cell unselectable

massimoadriaens commented 1 year ago

I have tried putting that property to true for the correct dates. But I don't notice any effect. Even putting all the dates to isPast = true has no effect all. Is there an other property I can use?

massimoadriaens commented 1 year ago

I checked the demo 'Min max date' and was able to disable cells by providing a cssClass to my day.