Can someone please guide me how to hide weekends from modern calendar. Options that I could find are related to classic calendar in SharePoint.
-
Are you using modern calendar view in lists or using custom calendar web part created using SPFx?– Ganesh Sanap - MVPAug 16, 2022 at 4:53
-
I am first trying with OOTB modern calendar. With this I can add SPFX to hide certain functionality like “Add new” or double click event without removing the permissions.– SairaAug 16, 2022 at 9:00
1 Answer
You cannot hide weekend days from SharePoint OOTB calendar views in lists.
You may need to add custom JavaScript on modern pages to hide respective HTML elements from calendar view.
If you want to add custom JavaScript on single page, you can use modern script editor web part. See below links for more information:
- Hide Page Title and Command bar from Modern UI SharePoint pages
- "Modern Script Editor Feature" not available for activation from site features page
If you want to add custom JavaScript on all modern pages in site, you can use SPFx application customizer. Check this for more information: How can I include the same JS and CSS files on multiple SharePoint Modern Page?
Note: DOM manipulation & CSS customizations are not recommended by Microsoft and some of your customization may break if Microsoft changes HTML element id/classes in new release updates.
You can also use calendar web parts created using SPFx which you can customize according to your requirements. Check below SPFx samples:
-
Thank you Ganesh for the detailed helpful reply so I think best solution would be to create calendar in SPFX.– SairaAug 16, 2022 at 10:02
-
Yes, you get more control using SPFx to customize it as per your requirements. Also, you have to develop complete UI/functionality on your own. Aug 16, 2022 at 10:06