We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Remove blacked out months from being displayed in sfCalendar navigation

I am wondering if it is possible to configure or subclass sfCalendar for the following use case:

A registration system needs to accept Q1 (Jan, Feb, Mar) reservation dates for years 2020 through 2025.  The months for Q2-Q4 (Apr-Dec) should not be displayed in the control. For example, the 'next' date (shown in the UI) after Mar 31 2020 should be Jan 01 2021.

Is there a way to hide or no-display the dates in Q2-Q4 ?

1 Reply

KP Kanniyappan Panneer Selvam Syncfusion Team September 2, 2019 01:36 PM UTC

Hi Richard, 
 
Thanks for contacting Syncfusion support. 
 
We have checked your query “Remove blacked out months from being displayed in sfCalendar navigation” at our end. We have prepared the sample based on your requirement. In our sample, we have handled the blackout month range between April to December from SfCalendar navigation using Navigating event and navigated SfCalendar date to next year January using GotoDate method. Please find the code snippet and sample for the same. 
 
Code Snippet: 
 
 
if (e.NewValue.Start >= new DateTime(year, 04, 01) && e.NewValue.End <= new DateTime(year, 12, 31)) 
            { 
                e.Cancel = true;                 
            } 
            if(e.Cancel) 
            { 
                year++;                 
                this.sfCalendar1.GoToDate(new DateTime(year, 1, 1)); 
            } 
 
 
 
If we misunderstood your requirement, please provide more information regarding the requirement, it would be more helpful to proceed further.  
 
Regards, 
Kanniyappan P 


Loader.
Live Chat Icon For mobile
Up arrow icon