Timezone not accepted when "date's time zone handling"
| Project: | Date |
| Version: | 5.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
This might be related to: http://drupal.org/node/233432
CCK version 1.6.1
Drupal 5.5
"Configurable timezones enabled"
modules installed:
- all CCK modules
- all date 2 modules
I created a content type 'event' with a date with from / to values and the timezone handling set to "date's time zone handling". On the node edit form i can chose a time zone, but it doesn't get stored and falls back to the site's time zone.
I tried to fix, but I can't quite figure out what's wrong, as a screen dump of all parameters in date_field() shows me that on 'validate' the $items' time zone is the site's time zone...

#1
PHP 5.2.4
#2
I can't replicate this problem on the latest dev version. The latest version has this at the top:
// $Id: date_timezone.module,v 1.8.2.6 2008/04/03 10:32:29 karens Exp $
#3
Are you using the Event module? If so, this is a duplicate of http://drupal.org/node/240156.
#4
I am having the same issue, but the Event module has been disabled and uninstalled.
Adding some debugging code to date_elements, it looks like the current site's default (or existing timezone for this field) is possibly being returned and the new value I select in the Timezone dropdown is ignored.
I am stepping through the code to follow the variable.
<?phpfunction date_timezone_validate($element) {
form_set_value($element, $element['#value']['timezone']);
global $form_values;
print_r($form_values);
}
?>
Here, everything is correct I believe (I am changing it from America/New_York to America/Chicago):
<?php
[field_calendar_date] => Array
(
[0] => Array
(
[timezone] => America/Chicago
[value] => Array
(
[date] => 2008-05-27
[time] => 07:45AM
)
[value2] => Array
(
[date] => 2008-05-27
[time] => 09:30AM
)
)
?>
.. but by the time we get to _date_field_update, it is wrong again:
<?php
[field_calendar_date] => Array
(
[0] => Array
(
[timezone] => America/New_York
[value] => 2008-05-27T11:45:00
[value2] => 2008-05-27T13:30:00
[offset] => -14400
[offset2] => -14400
[rrule] =>
)
[rrule] =>
)
?>
This is the value that sticks as that date field's original timezone, regardless of my dropdown choice of a different timezone
#5
subscribe.
I have same issue with:
Drupal 5.7,
CCK version 1.6.1,
Date_api, Date_timezone, Date.
- with Configurable timezones, updated node and db table has user's timezone.
- without Configurable timezones, updated node and db table has site's timezone.
I wonder date_default_timezone_name() is executed somewhere.
- My Timezone select code in cck node create/update form is:
<select id="edit-field-fieldname-0-timezone-timezone" class="form-select date-timezone" name="field_fieldname[0][timezone][timezone]">Is this duplicated [timezone] right way?
#6
I just committed a fix for the problem that probably caused this.
#7
Thank you for the commit.
Your commit helped me a lot but my problem remained.
Then, I might just found another bug.
Could you please review the patch?
The problem seems to be in function date_combo_validate in date_elements.inc.
#8
above patch seems to solve my problem.
#9
I committed a different fix for this problem this morning, but thanks for the work. Your fix would work for fields without multiple values, but multiple value fields must always get the timezone changes from the first timezone element, which is the only one exposed to the user.
#10
Automatically closed -- issue fixed for two weeks with no activity.
#11
I still face the issue of not being able to set a CCK time zone handling field to values other than 'No time zone conversion'.
My site's time zone is set to Asia/Hong Kong. When I imported dates in mm/dd/yyyy format to CCK date fields via the node import modules, all the dates shown afterward became one day earlier.
I'm running drupal 5.7, cck-5.x-1.7, node_import-5.x-1.6. I've tried both date-5.x-2.0 rc3 & rc4, but the results were the same.
Any clues will be highly appreciated.