React-big-calendar: Starting time too early

Created on 24 Dec 2016  路  10Comments  路  Source: jquense/react-big-calendar

Thanks again for this component.

I'm using it here: http://silicondzor.com and I'd like the default starting times on week, day not be 12:00AM but something different, like 9am or something.

I didn't see what would be the relevant prop, help appreciated.

Most helpful comment

@fxfactorial @jquense

What I want is to show time 9 AM when we first render over calendar but later if user scroll to say 4 PM and change date, prevent scrolling again to 9 AM.

code for big calendar reside inside render function

is there any way to set up initial time like default date

All 10 comments

The min and max props control the time range on the week and day views

@jquense Thanks, I'm not clear though because a date object creates a specific time period, that is a year, date whereas I'm just interested in a time range. What would be a correct date objects to say only events from 11AM to 8PM?

Some inputs I'm using are causing odd behavior with the calendar itself, like an endless scroll downward.

the min and max apply to just the time views, so any date object with the right time will work as the date part is ignored

@jquense I've tried these values:

      min={new Date(2016, 10, 0, 2, 0, 0)}
          scrollToTime={new Date(2016, 1, 1, 10)}

and it creates an infinite week scroll. I've also noticed that using a date, like say 1970, causes a massive allocation, slow down so maybe some complexity gains to be had...

that is almost certainly something unrelated, there is no scroll logic at all in the Calendar, so maybe you have something else conflicting with it

o sorry right there is the scrollToTime. tbh I didn't write that code (or use it :P) so there may be a stck overflow issue. Glad to accept patches

make sure you aren't creating the scrollToTime date on each render, it does a comparision between the last and next prop value, so if you are doing new Date in render it's going to constantly see those as different and continually try and scroll

@jquense okay that was it, I was making a new one each render, now everything is great! Thanks!

@fxfactorial @jquense

What I want is to show time 9 AM when we first render over calendar but later if user scroll to say 4 PM and change date, prevent scrolling again to 9 AM.

code for big calendar reside inside render function

is there any way to set up initial time like default date

@fxfactorial @jquense

What I want is to show time 9 AM when we first render over calendar but later if user scroll to say 4 PM and change date, prevent scrolling again to 9 AM.

code for big calendar reside inside render function

is there any way to set up initial time like default date

Hi Sandeep I think what @jquense mentioned in a comment above (https://github.com/intljusticemission/react-big-calendar/issues/239#issuecomment-269095132) is what will help you. don't use a new Date() in render. Instead store it in a variable say state and pass it into BigCalendar as the value for scrollToTime. See if that helps.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bionicvapourboy picture bionicvapourboy  路  3Comments

gsavvid picture gsavvid  路  3Comments

tiaaaa123 picture tiaaaa123  路  4Comments

kromit picture kromit  路  4Comments

npalansky picture npalansky  路  3Comments