Drupal version 6.22

On updating to Date 6x-2.8, events using date on the Calendar module no longer appear if they are on the last day of any month (whether it's the 29th, 30th, or 31st), when nearing midnight. For instance, an event on February 29 at 7pm doesn't appear; but one at 7am does appear.

This is a critical issue, since we need to get the security updates but cannot update our production installation until this is fixed.

Prior to Date 6x-2.8, the calendar was working normally and as expected.

Comments

webdrips’s picture

I too am experiencing this issue. The trigger appears to be the offset from GMT (in my case -8 for PST).

If I set an event's time from 4:00 to 5:00, the event appears in the calendar view for the following month. Since 4 + 8 = 12, it leads me to believe the offset from GMT is causing the issue.

If I set the date of an event back to say 2:00 to 3:00, it appears on the calendar in the proper month.

Using the latest version of calendar/views BTW.

technicalknockout’s picture

I did a little poking around on my site and database. This is what I found:
- First of I have a calendar event on Feb 29 7:00 pm and my site is at UTC -7:00. The event is not displaying
- looking at 'admin/build/views/edit/calendar' and previewing 2012-02 the query displayed is:

SELECT ... blah blah blah  ... WHERE ... DATE_FORMAT(STR_TO_DATE(node_data_field_date.field_date_value2, '%Y-%m-%dT%T'), '%Y-%m') >= '2012-02')) ... blah blah blah

- querying the database manually for my node ...

SELECT *  FROM content_field_date WHERE nid=163;

... I get:

+-----+-----+---------------------+---------------------+
| vid | nid | field_date_value    | field_date_value2   |
+-----+-----+---------------------+---------------------+
| 165 | 163 | 2012-03-01T02:00:00 | 2012-03-01T02:00:00 |
+-----+-----+---------------------+---------------------+
1 row in set (0.00 sec)

Not sure yet how/where the SQL query is being created just yet, but I hope this helps track down the bug.

technicalknockout’s picture

It looks like the views argument is being passed on directly but maybe it should be adjusted for the system timezone?

retorque’s picture

Lines 296 and 297 in date_api_argument_handler.inc did not exist in a previous version of the module that I had running on another site. When I commented out line 297, the event appeared in my calendar.

// Setting the offset to avoid trying to use timezone adjustments for dates that don't need it.
$this->offset = in_array($this->date_handler->granularity, array('hour', 'minute', 'sec')) ? NULL : 0;

I have not yet done any research to find out what commenting out that line might break, but I'm hoping someone else might know and speak up before I dig too deep.

retorque’s picture

It looks like line 297 was probably part of a change intended to correct this issue: http://drupal.org/node/745074

I'm not sure I have the necessary knowledge to determine what might break. Since the actual code change is not posted in a patch (the posted patches were not used), I'm not clear on exactly what else might have changed, either.

mrothmay’s picture

Any development on a tested patch for this bug? Does commenting out line 297 seem to break anything?

webdrips’s picture

Confirming that commenting out line 297 of date/includes/date_api_argument_handler.inc seems to address the underlying issue.

Will continue to test over the next week or so and see if anything negative happens.

technicalknockout’s picture

Component: Date API » Views Argument
Status: Active » Needs review
StatusFileSize
new594 bytes

Nice, that worked for me also. Just made a patch for review.

I also ran the tests with and without applying the patch. The results included 3 test fails and 15 exceptions, but they were thrown both times I ran the tests, so at least nothing new broke... The failed tests were part of the CCK UI tests, I'll take some screenshots and upload.

Status: Needs review » Needs work

The last submitted patch, events_on_calendar_disappear-1411872-08.patch, failed testing.

technicalknockout’s picture

Version: 6.x-2.8 » 6.x-2.x-dev
StatusFileSize
new53.26 KB
new41.2 KB
new38.32 KB

Just uploading screenshots of the test results.

technicalknockout’s picture

Status: Needs work » Needs review
arlinsandbulte’s picture

Status: Needs review » Closed (duplicate)

Pretty sure this is a duplicate of #1408216: Events no longer appearing in calendar.
That issue also provides a patch.

kassissieh’s picture

This fixed the calendar view, but http://drupal.org/node/1408216#comment-5557238 fixed both this and other timezone problems with views date filters.