Problem/Motivation

Calendar View doesn't appear to use the site's Default Time Zone, as your calendar items may appear on wrong day in Month View. Please see the attached screenshot in PNG format.
The site's Default Time Zone, under Regional Settings, is set for America/New_York.
The site appears to be using UTC/GMT to sort which day the calendar item is to appear.

<a href="/node/20" hreflang="en">Bulletin Board Decorating (ou)</a> at Machias 
                      <time datetime="2015-12-01T15:00:00Z" class="datetime">Tue, 12/01/2015 - 10:00</time></a>
<a href="/node/27" hreflang="en">Music w/Pete &amp; Friends (gr)</a> at Machias
                      <time datetime="2015-12-02T00:00:00Z" class="datetime">Tue, 12/01/2015 - 19:00</time></a>
                        

Proposed resolution

(Description of the proposed solution, the rationale behind it, and workarounds for people who cannot use the patch.)
I'll be adding more here ... have to get home.

Remaining tasks

(reviews needed, tests to be written or run, documentation to be written, etc.)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

GreenSkunk created an issue. See original summary.

tedbow’s picture

Title: Calendar Items appear on wrong day in Month View » Calendar Items appear on wrong day in Month View - Timezone error
Status: Active » Needs review
FileSize
916 bytes

@GreenSkunk thanks for catching this.

I created a patch that fixes this. The events should appear in the right day. It was a timezone issue when determine the date.

This though

<a href="/node/20" hreflang="en">Bulletin Board Decorating (ou)</a> at Machias 
                      <time datetime="2015-12-01T15:00:00Z" class="datetime">Tue, 12/01/2015 - 10:00</time></a>
<a href="/node/27" hreflang="en">Music w/Pete &amp; Friends (gr)</a> at Machias
                      <time datetime="2015-12-02T00:00:00Z" class="datetime">Tue, 12/01/2015 - 19:00</time></a>

is created by the DateTime module in core in the \Drupal\datetime\Plugin\Field\FieldFormatter\DateTimeDefaultFormatter.
It appears to for the datetime attribute of the element it is always using the "ISO" date. This looks intentional but I am not sure. But this doesn't affect Calendar.

Please test the patch and let me know and I can commit it.

  • tedbow committed 50b2ff3 on 8.x-1.x
    Issue #2632114 by tedbow, GreenSkunk: Calendar Items appear on wrong day...
tedbow’s picture

Status: Needs review » Fixed

Ok committed this patch. I check to make sure the placement respects the current user's timezone. I also checked that this did not affect base timestamp fields like create,changed.

GreenSkunk’s picture

@tedbow I apologize as I missed your post.
Applied the patch and it works!

Please contact me if you need any Date or Calendar testing.

Note: I'm fine with the "microdata" output of the date field of
<time datetime="2015-12-01T15:00:00Z" class="datetime">Tue, 12/01/2015 - 10:00</time>

tedbow’s picture

@tedbow I apologize as I missed your post.

No problem!

Please contact me if you need any Date or Calendar testing.

Thanks for the offer. I will keep you in mind when I get back to this module.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

W01F’s picture

I'm still experiencing this issue with several of my events on the latest 8.x-1.x-dev version. I have several events with date fields that are showing the wrong day when the time is set before noon.

toegristle’s picture

I'm also still experiencing this issue with the latest version. The file in the patch above is not currently in the module. Browsing the repo it looks like it was just removed in the latest commit.

ronchica’s picture

I am still experiencing this issue. Cannot use the patch because the file was removed here: https://www.drupal.org/node/2735289

webpotato’s picture

Hello? I'm trying to configure this calendar on a D8.2 site and an event scheduled for Nov. 30 at 6:30pm shows up on Dec. 1. Not wanting to use a calendar that doesn't know what day it is right out of the box, pretty much.

I have tried various timezone options within the Drupal system with no effect. I had a similar issue with CiviCRM and set up a work-around, but still always get a timezone mismatch warning in CiviCRM. Similar work-around not effective in current case.

Really, there hasn't been any movement on this since the last commit in June? Are other folks just building calendars from scratch? How hard can it be to have a working calendar module in D8?

cappybara’s picture

@webpotato I was having this problem too. It appears to be an issue with the DateTime and Views modules, so it's sort of out of scope for Calendar to fix that behavior itself. The problem is discussed over here: https://www.drupal.org/node/2627512

I'm using the most recent patch from that issue in production, because this was something our customer was desperate to have fixed, and it's working fine. As always though, patch at your own risk. Hopefully their solution gets approved soon and makes it into a Core update.