I'm using a date CCK field to store a date and time with a configurable time zone.

If I save a node with a single date, then the date saves to the CCK field's table in the database with the offset and offset2 values set correctly.

e.g, with timezone set to America/Vancouver, I get offset = -25200

If I save a node with the same date and time, but have the event repeat every week, then no offset nor offset2 value is saved in the database.

e.g., with timezone set to America/Vancouver, I get offset = 0

This causes the date and time to appear incorrectly on the node's page. It appears as 7 hours ahead because the timezone offset is not being applied.

How can I get the offset value to save to the database when there are multiple dates?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

endless_wander’s picture

In date.module, in the date_formatter_process() function, if I log the following line, the correct offset values are there:

$dates[$processed]['local']['offset'] = date_offset_get($date);

But this is never saved to the database when repeat dates are entered. Still investigating.

endless_wander’s picture

I solved my problem of the wrong time appearing in the node display by using the date_offset_get() function to add on the appropriate offset to my times.

Still, this seems like a bug that the offset and offset2 values are not set in the database.

needle’s picture

Version: 6.x-2.7 » 6.x-2.9
Component: Date CCK Field » Code

Encountering the same issue. Thanks for posting a workaround, clavigne, however I use `variable_get('date_default_timezone', 0)` to get Drupal's setting instead of the server's.

srees’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
1.53 KB

I've written a patch to fix this. It was a logic error in date_repeat.inc

I've attached a patch for testing by the community.

Status: Needs review » Needs work

The last submitted patch, 4: offset_missing_repeating_dates-1317586-4.patch, failed testing.

The last submitted patch, 4: offset_missing_repeating_dates-1317586-4.patch, failed testing.

srees’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 4: offset_missing_repeating_dates-1317586-4.patch, failed testing.

srees’s picture

Version: 6.x-2.9 » 6.x-2.x-dev
srees’s picture

Status: Needs work » Needs review
DamienMcKenna’s picture

Status: Needs review » Closed (won't fix)

I'm sorry but the Drupal 6 version of this module is no longer supported. That said, I appreciate the time you spent on this.