I'm working on changing my sites' events from the Events module to Date+Calendar. I've got a new content type with date fields for the events (and a calendar view of them). I'm using an input format like "January 25, 2012 - 10:35pm, and the Javascript popup to select the days and allow arrow shifting of the time values. This all works fine except for a problem with the time zone handling. If I use "Site's time zone" in the date field settings for my new content type, eight hours gets added to my times in the database (to convert them to UTC, which is what's supposed to happen, as I understand it - they are in ISO date and time format - YYYY-MM-DDTHH:MM:SS with no offset). However, they are not converted back to the site's time zone when they're actually displayed in the nodes for the new content type. (The same thing happens if I change the input format to "January 25, 2012 - 10:35pm -8:00".)

I can fix this by setting the field's "Time zone handling" to "No time zone conversion". However, when I try to use Date Tools to import my old Event module nodes into my new content type nodes, the times for *those* get eight hours added to them. (They're stored in the database formatted as YYYY-MM-DD HH:MM:SS, with the correct time values for my site time zone. This is apparently the correct result of my having the "Event time zone input" in the Event module's timezone handling set to "Use the sitewide time zone", but unfortunately that label doesn't seem to produce the same handling of the offset that "Site's time zone" produces in the date field settings for my new content type.) This addition of the eight hours to the time values for the imported nodes happens whether I use "Site's time zone" or "No time zone conversion" in the date field settings for my new content type.

I've updated to the current development snapshot for Date (and Calendar), but I still have the problem. I assume I have something set wrong, since I can't find any other posts about this problem, but I can't figure out what it is...

My export of the new content type with the date field follows. (This sounds like the same problem as http://drupal.org/node/340623, which go closed after the initial post of the issue wasn't followed up.) Thanks in advance for any suggestions...

$content['type'] = array (
'name' => 'New Event',
'type' => 'newevent',
'description' => 'Test of calendar update',
'title_label' => 'Title',
'body_label' => 'Body',
'min_word_count' => '0',
'help' => '',
'node_options' =>
array (
'status' => true,
'promote' => true,
'sticky' => false,
'revision' => false,
),
'upload' => '1',
'old_type' => 'newevent',
'orig_type' => '',
'module' => 'node',
'custom' => '1',
'modified' => '1',
'locked' => '0',
'image_attach' => '0',
'image_attach_maximum' => '0',
'image_attach_size_teaser' => 'thumbnail',
'image_attach_size_body' => 'thumbnail',
'comment' => '2',
'comment_default_mode' => '4',
'comment_default_order' => '1',
'comment_default_per_page' => '50',
'comment_controls' => '3',
'comment_anonymous' => 0,
'comment_subject_field' => '1',
'comment_preview' => '1',
'comment_form_location' => '0',
'composite_enabled' => 0,
'composite_referenceable_types' =>
array (
'blog' => false,
'book' => false,
'classified' => false,
'event' => false,
'image' => false,
'newevent' => false,
'page' => false,
'panel' => false,
'poll' => false,
'story' => false,
),
'composite_advanced_view' => '--',
'composite_advanced_view_args' => '',
'event_nodeapi' => 'never',
);
$content['fields'] = array (
0 =>
array (
'label' => 'New Event Date',
'field_name' => 'field_neweventdate',
'type' => 'date',
'widget_type' => 'date_popup',
'change' => 'Change basic information',
'weight' => '-3',
'default_value' => 'blank',
'default_value2' => 'same',
'default_value_code' => '',
'default_value_code2' => '',
'input_format' => 'F j, Y - g:ia',
'input_format_custom' => '',
'year_range' => '-3:+3',
'increment' => '15',
'advanced' =>
array (
'label_position' => 'within',
'text_parts' =>
array (
'year' => 0,
'month' => 0,
'day' => 0,
'hour' => 0,
'minute' => 0,
'second' => 0,
),
),
'label_position' => 'within',
'text_parts' =>
array (
),
'description' => '',
'group' => false,
'required' => 1,
'multiple' => '0',
'repeat' => 0,
'todate' => 'optional',
'granularity' =>
array (
'year' => 'year',
'month' => 'month',
'day' => 'day',
'hour' => 'hour',
'minute' => 'minute',
),
'default_format' => 'medium',
'tz_handling' => 'site',
'timezone_db' => 'UTC',
'op' => 'Save field settings',
'module' => 'date',
'widget_module' => 'date',
'columns' =>
array (
'value' =>
array (
'type' => 'varchar',
'length' => 20,
'not null' => false,
'sortable' => true,
'views' => true,
),
'value2' =>
array (
'type' => 'varchar',
'length' => 20,
'not null' => false,
'sortable' => true,
'views' => false,
),
),
'display_settings' =>
array (
'weight' => '-3',
'parent' => '',
'label' =>
array (
'format' => 'hidden',
),
'teaser' =>
array (
'format' => 'medium',
'exclude' => 0,
),
'full' =>
array (
'format' => 'medium',
'exclude' => 0,
),
5 =>
array (
'format' => 'default',
'exclude' => 0,
),
4 =>
array (
'format' => 'default',
'exclude' => 0,
),
2 =>
array (
'format' => 'default',
'exclude' => 0,
),
3 =>
array (
'format' => 'default',
'exclude' => 0,
),
'ad list' =>
array (
'format' => 'default',
'exclude' => 0,
),
'token' =>
array (
'format' => 'default',
'exclude' => 0,
),
),
),
);
$content['extra'] = array (
'title' => '-5',
'body_field' => '-2',
'revision_information' => '1',
'author' => '0',
'options' => '2',
'comment_settings' => '3',
'menu' => '-4',
'book' => '-1',
'path' => '5',
'attachments' => '4',
);

Comments

curtzt’s picture

Issue summary: View changes

I edited this slightly to clarify what's going on.

curtzt’s picture

Issue summary: View changes

Added a link to another post I found about this.

curtzt’s picture

Issue summary: View changes

Filled in some more background details, no changes in the substantive issue.

jc1’s picture

My resolution was:

- set site time zone to empty
- set date field timezone to site's time zone
- import data from events to date field
- change site time zone to real TZ
- chenge date field TZ to "no conversion"

Now i have the same times in date fields and event fields.

DamienMcKenna’s picture

Status: Active » Closed (outdated)

We're sorry but the D6 release of Date module is no longer being supported. You are encouraged to update to Drupal 7 or 8, or direct questions to Drupal Answers.