[TYPO3-core] RFC: bug #7897: Datetime saving across DST switches shifts time

Ernesto Baschny [cron IT] ernst at cron-it.de
Wed Apr 2 12:57:23 CEST 2008


This is a SVN patch request.

Problem:
On fields of type "datetime" and "date", if you set a date in future or 
past that is in a different DST (daylight saving time) condition than 
your browser currently is (either you are in DST and the date you want 
to set is not, or the other way around), the stored date (displayed in 
the List-view) is different from the date displayed in the BE-edit form.

It is shifted by 1 hour or by 1 day, e.g if you are in DST and the date 
you want to set is not in DST.


Solution:
When storing and handling the time information in javascript and in 
outputting it we currently normalize the information to UTC-time. The 
bug was that we were assuming the the offset to UTC is always the same. 
This is of course wrong: When client switches to DST the offset to UTC 
either grows or shrinks by 60 minutes. So to calculate the UTC time, we 
need to get the "offset to UTC" of the date we are trying to store and 
not use "today" as a base of the calculation.

The change has to be done on server side (server converting stored local 
time to UTC time) and on client side (javascript converting local input 
date to UTC time). Attached patch does that.


Branches: TYPO3_4-2  (critical bug!!)


Bugtracker reference:
http://bugs.typo3.org/view.php?id=7897

-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug-7897-tz-dst.diff
Type: text/x-diff
Size: 2924 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20080402/63fc3138/attachment.diff 


More information about the TYPO3-team-core mailing list