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

Steffen Kamper steffen at sk-typo3.de
Sun Feb 24 14:11:10 CET 2008


"Martin Kutschker" <martin.kutschker-n0spam at no5pam-blackbox.net> schrieb im 
Newsbeitrag 
news:mailman.1.1203858170.10376.typo3-team-core at lists.netfielders.de...
> 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 :-(
>

i think the naming is irretating. lastTime is the internal temp var to 
calculate the time. if you click on checkbox, lastTime uses time of "today" 
otherwise it has the calculated time.
lasttime is stored as timestamp, calculation is done with date object.

>> 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

my intention was to show the time in BE in servers timezone to prevent 
double conversion.
this can be enhanced by "Show dates in x timezone", but until this isn't 
done i used servers timezone.

I think we first need a correct handling and then we can enhance display 
modes.

vg Steffen 




More information about the TYPO3-team-core mailing list