You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Utilities currently override props passed to BigCalendar misrepresenting expected outcome.
What's the expected behavior?
If I pass the getNow() prop a function that returns a date for today in a desired timezone (eg getNow={() => moment('2018-08-22 15:30:00').toDate()})), it will render the time indicator on the returned date.
Details
Currently, in lieu of complete time zone support, there are a number of workarounds to fix certain, but not all, problems. My current issue lies with the getNow() prop that can be used to place the time indicator. However, the time indicator's position is determined by the below function in TimeGrid.js, which checks against the today() method in utils/dates.js. This uses new Date() to detemine what 'today' is, which will default to use the time zone of the machine currently accessing the page.
Because of this, I am unable to accurately place the time indicator as desired, even if I set the getNow() prop to return the desired date. For example, if I set getNow() to return a JS Date for MST and am accessing from a machine in Australia, the today() method will check against a new Date() in relation to Australia, not MST, placing the time indicator a day ahead. The expected behavior of the getNow() prop would be to force set or adjust how the current date/time is rendered on the calendar. Unfortunatley, this is overriden by the today() method.
If anyone has any work around for this or an idea of how to manipulate the dates utilities, that would be amazing. Thanks in advance!
Do you want to request a feature or report a bug?
What's the current behavior?
BigCalendar
misrepresenting expected outcome.What's the expected behavior?
getNow()
prop a function that returns a date for today in a desired timezone (eggetNow={() => moment('2018-08-22 15:30:00').toDate()})
), it will render the time indicator on the returned date.Details
Currently, in lieu of complete time zone support, there are a number of workarounds to fix certain, but not all, problems. My current issue lies with the
getNow()
prop that can be used to place the time indicator. However, the time indicator's position is determined by the below function inTimeGrid.js
, which checks against thetoday()
method inutils/dates.js
. This usesnew Date()
to detemine what 'today' is, which will default to use the time zone of the machine currently accessing the page.Because of this, I am unable to accurately place the time indicator as desired, even if I set the
getNow()
prop to return the desired date. For example, if I setgetNow()
to return a JS Date for MST and am accessing from a machine in Australia, thetoday()
method will check against anew Date()
in relation to Australia, not MST, placing the time indicator a day ahead. The expected behavior of thegetNow()
prop would be to force set or adjust how the current date/time is rendered on the calendar. Unfortunatley, this is overriden by thetoday()
method.If anyone has any work around for this or an idea of how to manipulate the
dates
utilities, that would be amazing. Thanks in advance!utils/dates.js
https://github.com/intljusticemission/react-big-calendar/blob/d1e90b148a0be2b71f2c1887b196cf5df088535c/src/utils/dates.js#L144-L146
src/TimeGrid.js
https://github.com/intljusticemission/react-big-calendar/blob/d1e90b148a0be2b71f2c1887b196cf5df088535c/src/TimeGrid.js#L325-L355
The text was updated successfully, but these errors were encountered: