[TYPO3-core] RFC #7626: Date/time handling is completely broken in 4.2

Martin Kutschker martin.kutschker-n0spam at no5pam-blackbox.net
Sun Feb 24 14:02:52 CET 2008


Steffen Kamper schrieb:
> I debugged the JS to see what happens.
> 
> Result is that JS does wrong calculation.
> what i tried:
> server: UTC +1
> client:  UTC +3
> 
> Input: 22:00 24-2-2008
> Result: 23:00 24-2-2008
> 
> JS uses the timeoffset:
> theTime.setTime((this.lastTime - theTime.getTimezoneOffset()*60)*1000);
> 
> theTime.getTimezoneOffset() is -180, so you see that calculation is wrong.
> transfered time is: 22:00
> 
> Server thinks he get an UTC and adds 1 hour (UTC +1)

BTW, can you explain me what the whole lastTime business is all about? 
This variable wasn't self explaining to me and the whole non-trivial 
time handling lacks documentation :-(

> The fatal and breaking point is, that server adds this one hoer everytime 
> you save the form, independent of your change in this field, so this can't 
> work.
> 
> To get a right result JS calculation should only used when the value of the 
> field change, and then it should be converted to servers timezone, server 
> should save this as it is.
> With server timezone it's possible to display the date in any timezone.
> 
> So the missing part for this is a var in JS with the servers timezone (or 
> offset) and the differing (general eval or filed change (or on lost focus)

Why do you need the offset of the server? ... ah ... if you want to show 
the time in the TZ of the server and not in the TZ of the client. But do 
we want that? As long as it is clear it's not a problem, but it should 
be defined (possibly configurable) in what TZ the date/times are shown 
and edited in the BE. Otherwise the whole transfer of date/times in UTC 
is pointless.

Masi


More information about the TYPO3-team-core mailing list