Timezone not accepted when "date's time zone handling"

alex_b - March 17, 2008 - 19:07
Project:Date
Version:5.x-2.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

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

alex_b - March 17, 2008 - 20:11

PHP 5.2.4

#2

KarenS - April 17, 2008 - 13:31
Status:active» active (needs more info)

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

KarenS - April 17, 2008 - 17:06

Are you using the Event module? If so, this is a duplicate of http://drupal.org/node/240156.

#4

fysa - May 12, 2008 - 22:11
Priority:normal» critical

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.

<?php
function  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

whalebeach - May 23, 2008 - 14:22

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

KarenS - May 25, 2008 - 23:02
Status:active (needs more info)» fixed

I just committed a fix for the problem that probably caused this.

#7

whalebeach - May 26, 2008 - 15:01
Status:fixed» patch (code needs review)

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.

AttachmentSize
date_element.diff617 bytes

#8

whalebeach - May 26, 2008 - 15:29

above patch seems to solve my problem.

#9

KarenS - June 17, 2008 - 12:55
Status:patch (code needs review)» fixed

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

Anonymous (not verified) - July 1, 2008 - 12:55
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

#11

freelancer-hk - July 31, 2008 - 06:35

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.

 
 

Drupal is a registered trademark of Dries Buytaert.