How can I limit the calendar to yesterday, today and tomorrow?
thanks
I had a similar situation. I wanted to display just a slice of a single day and then manually control navigation between days. To do this I used the Timeline components visibleStartTime, visibielEndTime, and onTimeChange props.
For your case you'll probably need to use those props as well as the onBoundsChange, canvasTimeStart, and canvasTimeEnd prop in a similar way.
In my use case I defined dayStart and dayEnd variables which are JavaScript Dates. I then used it as follows with the props.
visibleTimeStart={dayStart}
visibleTimeEnd={dayEnd}
// Prevents the time from changing beyond our selected date.
onTimeChange={(visibleTimeStart, visibleTimeEnd, updateScrollCanvas) => updateScrollCanvas(dayStart, dayEnd)}
To build on what @Biohazord said, heres a working example that limits the range from yesterday to tomorrow:
https://codesandbox.io/s/m31jpjn9oy
It's a little buggy on scroll but gives an idea of how to accomplish this.
@mcMickJuice @Biohazord thanks i got it to work using ur solution
How can i limit the journey of a day to 17 h each day of calendar.
thanks
Most helpful comment
To build on what @Biohazord said, heres a working example that limits the range from yesterday to tomorrow:
https://codesandbox.io/s/m31jpjn9oy
It's a little buggy on scroll but gives an idea of how to accomplish this.