user

Shilpa

11 Mar 2022

How to bind Weekends off to my kendo calendar in Angular?

Angular

I am using kendo calendar  datepicker in angular component. Is there any way to disable or hide weekends dates (Saturday & Sunday)?

<kendo-datepicker id="workingDays" [(ngModel)]="workingDay"
 class="m-2 col-12" format="dd MMMM yyyy">
</kendo-datepicker>

Can I get USA calendar with Kendo library to see the public holidays programmatically? and disable those date from the showing on calendar?

** URGENT **

I need to fix this issue ASAP! Your help is valuable for me.

Comments

Rakshit

18 Mar 2022

To disable weekends (Saturday and Sunday) you can use below code.

Add HTML kendo datepicker code:

<kendo-datepicker style="padding:5px;"
 [(ngModel)]="value"
 [disabledDates]="disabledWeekendDates"
 >
 </kendo-datepicker>

Add your .ts code as below,

public disabledWeekendDates = (date: Date): boolean => {
 //date.getDay() will return day for each days rendering on your calendar / datepicker.
 return date.getDay() == 0 || date.getDay() == 6 ? true : false;
 };

Live Demo | Runnable Code

Hope the given information will be helpful for you.

Shilpa

22 Mar 2022

github

Thanks, for the quick response, stackblitz demo looks good as per my requirements.

© 2024 Copyrights reserved for web-brackets.com