Hi,

Currently have the events module setup on two similar drupal 5.0 installations on different machines. Both have their timezone set to PDT (-0700) and have their clocks set to the same time, and have the site's default timezone set to EST (-0500). On both drupal installations, the Configurable Time Zones options is turned off, and event time zone input is set to sitewide timezone.

Now that that is done, here is what's happening...

Both installs show different times on the event creation form. When I create and event on one install, the form default displays start and end times 6 hours in the future. On the other install, the default times are set to 1 hour in advance. On both installs however, if I create an event using the default time provided, the newly created event is listed as going to happen 2 hours in the future.

These results are repeatable, and I could probably do a hack that's specific to each installation. But if anyone has any ideas or suggestions, they would be very much appreciated.

Thank you in advance for any assitance :)

Comments

Gekiboy’s picture

I have done a var_export on the $node as it enters the submit section of event_nodeapi. This output is from an event created at 10:24 using the default date/time that the form provided.

#

stdClass::__set_state(array(
'nid' => NULL,
'vid' => NULL,
'uid' => '1',
'created' => 1181323495,
'type' => 'events',
'changed' => '',
'title' => 'dsfsd',
'body' => 'sdfsd',
'format' => '1',
'venues' =>
array (
0 => '',
),
'bands' =>
array (
0 => '',
),
'log' => '',
'name' => 'admin',
'date' => '',
'status' => 1,
'promote' => 1,
'sticky' => 0,
'revision' => 0,
'preview' => 'Preview',
'op' => 'Submit',
'submit' => 'Submit',
'form_token' => '27beb8fff8e644ab4d4a4de5bd47023c',
'form_id' => 'events_node_form',
'comment' => '2',
'start_date' => '2007-06-08 14:24',
'end_date' => '2007-06-08 14:24',
'timezone' => '309',
'locations' =>
array (
0 =>
array (
'name' => '',
'street' => '',
'additional' => '',
'city' => '',
'province' => '',
'postal_code' => '',
'country' => 'us',
'latitude' => '',
'longitude' => '',
'lid' => NULL,
),
),
'menu' =>
array (
'title' => '',
'description' => '',
'pid' => '1',
'path' => NULL,
'weight' => '0',
'mid' => 0,
'type' => 86,
),
'path' => '',
'start_date_jscalendar' =>
array (
'ifFormat' => '%Y-%m-%d %H:%M',
'showsTime' => 'true',
'timeFormat' => '24',
),
'end_date_jscalendar' =>
array (
'ifFormat' => '%Y-%m-%d %H:%M',
'showsTime' => 'true',
'timeFormat' => '24',
),
'start_year' => '2007',
'start_month' => '6',
'start_day' => '08',
'start_hour' => '14',
'start_minute' => '24',
'event_start' => 1181330640,
'end_year' => '2007',
'end_month' => '6',
'end_day' => '08',
'end_hour' => '14',
'end_minute' => '24',
'event_end' => 1181330640,
))

#

stdClass::__set_state(array(
'nid' => NULL,
'vid' => NULL,
'uid' => '1',
'created' => NULL,
'type' => 'events',
'changed' => '',
'title' => 'dsfsd',
'body' => 'sdfsd',
'format' => '1',
'venues' =>
array (
0 => '',
),
'bands' =>
array (
0 => '',
),
'log' => '',
'name' => 'admin',
'date' => '',
'status' => 1,
'promote' => 1,
'sticky' => 0,
'revision' => 0,
'preview' => 'Preview',
'op' => 'Submit',
'submit' => 'Submit',
'form_token' => '27beb8fff8e644ab4d4a4de5bd47023c',
'form_id' => 'events_node_form',
'comment' => '2',
'start_date' => '2007-06-08 14:24',
'end_date' => '2007-06-08 14:24',
'timezone' => '309',
'locations' =>
array (
0 =>
array (
'name' => '',
'street' => '',
'additional' => '',
'city' => '',
'province' => '',
'postal_code' => '',
'country' => 'us',
'latitude' => '',
'longitude' => '',
'lid' => NULL,
),
),
'menu' =>
array (
'title' => '',
'description' => '',
'pid' => '1',
'path' => NULL,
'weight' => '0',
'mid' => 0,
'type' => 86,
),
'path' => '',
'start_date_jscalendar' =>
array (
'ifFormat' => '%Y-%m-%d %H:%M',
'showsTime' => 'true',
'timeFormat' => '24',
),
'end_date_jscalendar' =>
array (
'ifFormat' => '%Y-%m-%d %H:%M',
'showsTime' => 'true',
'timeFormat' => '24',
),
'teaser' => 'sdfsd',
'start_year' => '2007',
'start_month' => '6',
'start_day' => '08',
'start_hour' => '14',
'start_minute' => '24',
'event_start' => 1181330640,
'end_year' => '2007',
'end_month' => '6',
'end_day' => '08',
'end_hour' => '14',
'end_minute' => '24',
'event_end' => 1181330640,
))

Gekiboy’s picture

Status: Active » Closed (fixed)

There are bugs to how the event module works apparently. I have solved my issue with what is redoubtably a hack, but one that is scalable to my sites.

Michelle’s picture

Category: support » bug
Status: Closed (fixed) » Active

If you've found and fixed a bug, please share. Even if it's a hack, knowing what was wrong and what fixed it could help towards getting a proper fix.

Michelle

Gekiboy’s picture

Priority: Critical » Normal

I will provide what I'm able to. First off, I should note that I am using the jscalendar module as well. I'm not sure if the same issues apply to when it is not in use.

Just a reminder, this is with no configurable timezones and with the site timezone being different then the server's timezone.

Event creation form:

The date fields are generated in the event_form_alter() function around line 1887.

When the form initially loaded, the time on it was off. I took a look in to this, and I noticed that first off the time and date are pulled from the _event_user_time() which corrects between the server's time and the site's time. This functioned fine.

Then this date is passed in to the _event_date() function which format's the date for display, but also does some more time correction of it's own. For example, for a new event it was adding the SITE's timezone adjustment and then calling on gmdate to format the display but offsets by the SERVERS timezone difference. For an existing event, it offsets by a variable named $offset (which makes no sense to me since an already created event should just display it's current times when being edited).

Anyway, I simply changed it to offset by date('Z') instead so that gmdate recorrects it to the original time.

Event submission:

The following refers to the event_nodeapi() function around line 1989 under case 'submit'.

The first thing which is called in this area is event_validate_form_date() for both the start and the end date. After some testing I discovered that this function was throwing the time off... Again.

I didn't delve too deeply into this function. Rather, I noticed that every value except for event_start/event_end were set within the jscalendar if statement, and that the variable $timestamp was what I wanted event_start/event_end to be at this point. So, just before the } that closes the if statement, I put in "$node->{'event_'. $date} = $timestamp;" followed by a return statement.

Done!

(hope my description isn't too hard to read)

Michelle’s picture

Thanks for following up with this. V1 has so many time zone issues I'm not sure it's worth fixing. I'll test this in V2 and see if it's still a problem.

Michelle

japerry’s picture

Status: Active » Closed (outdated)

Event for Drupal 8 is unrelated to older versions. If an issue similar to this one exists, please open a new issue with the 8.x branch.