I have a Datestamp field configured with Date's timezone. I create a node and set the date to 2012-10-20 12:00 and set the timezone to America/New_York. It seems to save and display just fine.

However, when I go to edit the node, the text box as 2012-10-20 17:00 which looks to me like the saved time converted to UTC. If I happen to save this, it still uses the date timezone and thus adds 5 hours to the saved datestamp.

I've tried other storage types and none of them work.

CommentFileSizeAuthor
#1 date_elements.inc_.patch913 bytesbkat

Comments

bkat’s picture

StatusFileSize
new913 bytes

After some digging around I have made some changes that appear to be working for me. I believe the problem lies in date_elements.inc in the function date_local_date.

According to the date documentation, when timezone handling is date, the stored values are not converted to UTC. So what happens in _date_widget. date_local_date was doing conversions between UTC, the system timezone, and the dates timezone.

Basically it was reading the 12:00 from database and converting from system timezone (America/Chicago) which is 4 hours behind UTC on the date in question. This converted the date object to be 16:00 with the timezone America/Chicago. It then set the date timezone (America/New_York) which shifted the time to 17:00.

My included patch basically uses the date's timezone instead of the database timezone if timezone handling is set to date.

damienmckenna’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

Unfortunately the Drupal 6 version of the Date module is no longer supported. That said, we appreciate that you took time to work on this issue. Should this request still be relevant for Drupal 7 please feel free to reopen it. Thank you.