Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any way to limit the date range? #33

Open
tstrader opened this issue Mar 29, 2022 · 1 comment
Open

Is there any way to limit the date range? #33

tstrader opened this issue Mar 29, 2022 · 1 comment

Comments

@tstrader
Copy link

I would like the calendar to only allow viewing/selecting days that are in the next 3 months and none from the past. Any ways to currently disable browsing/selecting dates outside of a specified range?

@tstrader
Copy link
Author

tstrader commented Mar 29, 2022

I think this approach is what I'll likely end up using for my usecase unless there is a better way.
monthDiff just compares the months of 2 dates.

monthChanged: (selectedDate, events) => {
              if(monthDiff(today, selectedDate) == 0){
                leftArrow = document.getElementsByClassName('calendar__arrow-prev')[0];        
                leftArrow.style.display = "none";
              } else {
                leftArrow = document.getElementsByClassName('calendar__arrow-prev')[0];        
                leftArrow.style.display = "block";                
              }
              if(monthDiff(today, selectedDate) == 2){
                rightArrow = document.getElementsByClassName('calendar__arrow-next')[0];        
                rightArrow.style.display = "none";
              } else {
                rightArrow = document.getElementsByClassName('calendar__arrow-next')[0];        
                rightArrow.style.display = "block";                
              }
          }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant