[TYPO3-core] Patch: Fix Timezone date problems

Bernhard Kraft kraftb at kraftb.at
Fri Jan 20 01:38:35 CET 2006


Karsten Dambekalns wrote:

> So there will be nagtive timestamps in the DB, right? We have no PHP code to 
> handle this, so it'll be displayed correctly only in forms, or has this been 
> changed already?
> 
> I clearly remember the discussion about adding some enahnced date handling 
> functions to deal with dates before 1970...

When outputting negative timestampt no special care must be taken.
AFAIK they are everywhere used properly in the BE ... no problems so far:

The problem is the following (in short):
-------------------------
Server is in Berlin (GMT).
You have a "date" field.
A BE-user in Singapor inputs "1-1-1970" which gets converted to a UNIX timestamp (which
has no timezones) on his local box and which results in -28800 (-8 h) becase at the moment
when it is 0:0 1-1-1970 in Singapore it is 16:00 31-12-1969 in GMT.
The value get's always shown as 1-1-1970 when the Editor from Singapore views the page but
when displayed from the server (using strftime - either in BE or FE) it gets shown as 31-12-1969.
------------------------

(I know ... Those timezones are quite tricky)

By applying the attached patch (The last one didn't work correct. I tried to do everything on the
server ... but that isn't possible because of "logical" reasons. I will explain if you want :)
you get the desired behaviour if you enable "respectTimeZones" in the Install Tool.

You do not need to set serverTimeZone correctly as this get's found out by using date('Z', $timestamp)

it doesn't make sense to set a static timeZone as the timeDifference all after all changes each half year
for an hour (or at some places only a half, or a quarter :) ... you know: daylight savings time.

There was also a problem inputing dates during daylight savings time (winter time switch) even when you where
in the same time-zone as the server because the "time" part of a date get's calculated wrong (I wonder if this
ever was noticed by somebody else :) This is also fixed.

The patch also removes the limitation of a "year" date field (or did this make any sense ? it could also get
limited using range => upper, lower



greets,
Bernhard
-- 
----------------------------------------------------------------------
"Freiheit ist immer auch die Freiheit des Andersdenkenden"
Rosa Luxemburg, 1871 - 1919
----------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug_1697_2006-01-20_CVS.diff
Type: text/x-patch
Size: 15655 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20060120/bdbbc3c6/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20060120/bdbbc3c6/attachment.pgp 


More information about the TYPO3-team-core mailing list