-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Timezone problems. Moves everything over a day #809
Comments
I have the same problem when setting the timezone that behind the local timezone |
@jquense Hi there, do you know of any way to fix this? If not could you point me in the right direction to try myself and then I will make a push request. |
@ghostit-dev @thienlhh I've been working on this issue for a while now and have a few things I can add that might help fix (some) of the issues. First and foremost, the largest problem with timezone lies in the fact that, when converting to JS Dates (which My current workaround for events has been to pass strings to my component that houses For setting the highlighted date of 'Today', it's best to use the class CalendarWrapper extends Component {
state = {
today: null
}
comonentDidMount() {
const { todayString } = this.props
this.setState({ today: moment(todayString).toDate() })
}
render() {
const { today } = this.state
return (
<BigCalendar
defaultDate={today}
/>
)
}
} There's also a I'm about to open an issue for this to see if anyone has a solution, though, admittedly, if timezone capabilities were added, none of this would require a workaround. I know this may not answer your question specifically, but maybe it can shed some light on how to solve some of the time zone issues. |
Timezone support is a known issue but we need support if we are going to fix it. #118 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Does anyone know a fix for this problem? |
I have the same issue. My local time is CET and timezones work correctly if I set it to Tokyo, for example. But not for USA timezones. @KenneyE were you able to find a workaround for this problem? |
@goktugerce I didn't. We actually ended up displaying everything in the user's local timezone to not have to deal with this. We added a notice above the calendar that detected if the user was in a different tz than the facility, and let them know which tz the events are being displayed in, and that it isn't the same as the facility. |
I found a simple workaround for this, but it only works for display purposes. We are not doing any actions from the calendar apart from showing the events.
No need to do anything specific for the |
@goktugerce you are life savior. Thank you |
Do you want to request a feature or report a bug?
Code for screenshot(13)
//moment.tz.setDefault("America/Vancouver"); console.log(moment().format()); BigCalendar.setLocalizer(BigCalendar.momentLocalizer(moment));
Code for screenshot(14)
moment.tz.setDefault("America/Vancouver"); console.log(moment().format()); BigCalendar.setLocalizer(BigCalendar.momentLocalizer(moment));
You can see that the current date in the calendar moves over to the 16th when it is in fact the 17th in both timezones. You can see that I am console logging the moment date out. Does anyone have any ideas on how to fix this?
What's the current behavior?
You can see the error clearly in this sandbox:
https://codesandbox.io/s/m34q6xw6lx
It shifts all of the days over by one. Saying the current date is one less than the real current date.
Line 7 in the sandbox makes this occur, for some reason setting the moment timezone shifts all the days over by 1.
What's the expected behavior?
The expected behavior would be to display the correct dates, instead of moving everything over a day.
The text was updated successfully, but these errors were encountered: