question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Time zone issue with multi-day events

See original GitHub issue

Hey!

I’ve noticed a potential issue with multi-day events when viewing from a different time zone than the one that is set for the calendar. Single-day events work correctly.

In the example below, the multi-day event should span from 10/01/2022 to 14/01/2022. The time zone is set to Asia/Tokyo with the Moment.js localizer.

When viewing the calendar from the Asia/Tokyo time zone, the range is correct:

asian-tokyo

When viewing the calendar from the America/Los_Angeles (or Europe/Brussels) time zone, the range is 1 day short:

client-us-pacific

CodeSandbox of the demo: https://codesandbox.io/s/romantic-stonebraker-w633f?file=/src/App.js

Is this an issue with react-big-calendar or a mistake on my end?

Thank you!

Žiga

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
dphuang2commented, Aug 17, 2022

I had a problem where month was not showing mulit-day events on Saturdays in the Month view when setting timezone to UTC: Screen Shot 2022-08-17 at 9 02 47 AM

I did some debugging and found that the localizer.segmentOffset === 1 caused the span of the event to max at 6 (https://github.com/jquense/react-big-calendar/blob/e5721ef127d407a12ac74514981b311a1558fd2b/src/utils/eventLevels.js#L28). So I manually set localizer.segmentOffset = 0 outside of initializing the localizer and now I see the correct output: Screen Shot 2022-08-17 at 9 03 59 AM

The code to do so is:

moment.tz.setDefault('UTC')
const localizer = momentLocalizer(moment)
localizer.segmentOffset = 0

...

  return (
    <div className="height">
      <Calendar showMultiDayTimes localizer={localizer} events={events} />
    </div>
  )
1reaction
vman12300commented, May 12, 2022

Hi is there a workaround to get this fixed in the week view or workweek view? I also experience strange behavior in the workweek view when an event overlaps a week the Friday is skipped in the allday colum. But this is not always the case. My pc is set to English and then it works fine. But when the pc is set to Dutch this behavior occurs

Read more comments on GitHub >

github_iconTop Results From Across the Web

All Day Calendar Events and Different Time Zones
If an all-day or multi-day meeting (using the "All day event" checkbox) is created in a different time zone, Outlook has historically ...
Read more >
Use different time zones in Calendar on Mac - Apple Support
Change the time zone for an event ... Double-click the event, or force click it. Click the event's date, click the Time Zone...
Read more >
Recurring events lose automatic timezone conversion
A recurring event is always relative to the sender's timezone (or rather to the event location), and not to the recipient's timezone, ...
Read more >
Event time zones FAQ - Trumba Help
Yes. Event time zones work as expected with repeating and multi-day events. Back to FAQ list. Can I use bulk settings to change...
Read more >
All-day calendar events suffer from timezone issue turning 1 ...
To recreate, in the UK timezone (may work in others that observe DST) create a Monday all-day event set to repeat weekly, then...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found