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

Greater control/override of utils/dates.js #962

Closed
HartiganHM opened this issue Aug 22, 2018 · 1 comment
Closed

Greater control/override of utils/dates.js #962

HartiganHM opened this issue Aug 22, 2018 · 1 comment

Comments

@HartiganHM
Copy link

Do you want to request a feature or report a bug?

  • Feature

What's the current behavior?

  • 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!

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

@arecvlohe
Copy link
Collaborator

Also check #118

@jquense jquense closed this as completed Nov 19, 2018
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

3 participants