[TYPO3-core] RFC: Bug #1697: Datetime input fields and timezone shift bug

Ernesto Baschny [cron IT] ernst at cron-it.de
Mon Apr 30 12:52:09 CEST 2007


Hi, hope you all came home well from T3DD. It was nice to see you again!

This is SVN patch request.

Branch: trunk and TYPO3-4_1


Problem:
Editing date, datetime, time and timesec fields in BE when you have an
offset between your clients timezone and the server timezone leads to
wrong information being stored.

Related to this: The click-checkbox to set the current date did not work
on fields with eval year, time and timesec. This is also fixed with the
patch.


How to reproduce:
1) Install the extension user_datetest which I uploaded to the bug
report: http://bugs.typo3.org/view.php?id=1697. It will add a new table
"Date Test" where you can test all possible date-time field types that
we currently support in TCA.

2) Be sure that the server is on a timezone different from your client
(e.g. server in CEST, set your client to Auckland (GMT+12) or some other
bizarre timezone). You will have to at least restart your browser when
you change the OS timezone (at least on Windows). Your mileage will wary
depending on the clients way of handling timezones, so you might even
need to reboot for a TZ-change to effect your browser.

3) Create a new record "Date Test"

4) Force-Reloading of the alt_doc frame (CTRL-Reload on IE, SHIFT-Reload
on FF) after each change, because there is included Javascript that will
be changed by the patch.

5) Use the click-default buttons to see how they work (or not).

6) Store the record.

7) Watch in the Web>List view (Extended View) so that you see all fields
for in the list-table and compare the entered dates and especially times
with the displayed dates.


Solution:
The date on server is currently stored as a unixtime based on the server
local timezone. This requires no conversion of timezones if, server,
backend, frontend user are in the same timezone. To keep existing
extensions working we also have make sure that server + frontend output
is not being changed, which means we have to keep saving unixtime based
on server-timezone in the database.

The solution from the patch uses the UTC date as a timestamp transport
standard between the server and the backend-client and vice-versa. The
server will print out HTML and JS with a UTC-unixtime for the date in
the database (class.t3lib_tceforms.php). The client will work with that
UTC time and return UTC-time (all javascript based,
jsfunc.evalfield.js). The server will then translate that back to server
timezone and store it to the database (class.t3lib_tcemain.php).

This patch is based on the work of Mario Matzulla (author of "the
calendar") and reviewed, fixed and enhanced by both of us in a "night
session" during the developer days.


Reference:
http://bugs.typo3.org/view.php?id=1697


Cheers,
Ernesto
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug-1697.diff
Type: text/x-diff
Size: 12827 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20070430/07248fd0/attachment.bin 


More information about the TYPO3-team-core mailing list