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

Ernesto Baschny [cron IT] ernst at cron-it.de
Mon Oct 22 14:53:55 CEST 2007


Martin Kutschker wrote: on 20.10.2007 22:56:

>>>> 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.
>>> What's the intended behavior?

>> intended behavior is date/time entering without client calculating of
>> local time. Best would be to have all date/time-values in UTC to
>> decide which local time to be displayed..
>> Best example is a calendar, where entries are made from different
>> timezones. So the JS is calculating the time with the client local time.
> 
> I don't understand. The time displayed should be in the clients local
> time. OTOH the time stored should be independent from the clients time
> zone. Currently it is stored in the servers time zone, while UTC would
> have been a better choice.
> 
> So what does the patch?


Hi Ingo, Masi and others,

the problem can be reproduced in a very simple way, just follow the
"1-2-3" step guide in the original RFC. See below.

To sum up (again): Basically the stored time information is wrong when
server and client timezones are different. You enter a date "2007-10-22"
 in BE, but stored might be an unix-timestamp several hours before,
which might lead even the displayed date to be wrong (e.g.
"2007-10-21"). Or if you have a datetime field, you will end up with an
time offset that you didn't really entered.

Note that this is just a BUGFIX, I do not intend to rewrite the whole
datetime handling in TYPO3, so any suggestions about using adodb or
other time storing formats are another story and should be handled and
discussed in separately.


Here again the "How to reproduce" part:

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. If you don't like that, just create the
fields by hand in your TCA + sql.

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.


Cheers,
Ernesto


More information about the TYPO3-team-core mailing list