* Follow-up on bug #1697 (bug #7626): Timezone handling in datetime/time fields was...
authorErnesto Baschny <ernst@cron-it.de>
Mon, 25 Feb 2008 21:21:51 +0000 (21:21 +0000)
committerErnesto Baschny <ernst@cron-it.de>
Mon, 25 Feb 2008 21:21:51 +0000 (21:21 +0000)
* Fixed bug #7626: Corrected handling of so called "half-hour" timezones (e.g. +0430) which caused wrong data to be saved in time/datetime fields.

git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3287 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_tceforms.php
t3lib/class.t3lib_tcemain.php

index 8bf3e35..970defb 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-11-22  Ernesto Baschny  <ernst@cron-it.de>
+
+       * Follow-up on bug #1697 (bug #7626): Timezone handling in datetime/time fields was broken, causing time to jump +serverTZ on each record saving.
+       * Fixed bug #7626: Corrected handling of so called "half-hour" timezones (e.g. +0430) which caused wrong data to be saved in time/datetime fields.
+
 2008-02-25  Michael Stucki  <michael@typo3.org>
 
        * Follow-up on issue #7526: Add configuration option $TYPO3_CONF_VARS[BE][loginNewsTitle] to t3lib/config_default.php (Thanks to Steffen Kamper)
index e39ed63..39ddfe2 100755 (executable)
@@ -1116,8 +1116,7 @@ class t3lib_TCEforms      {
                }
                if((in_array('date',$evalList) || in_array('datetime',$evalList)) && $PA['itemFormElValue']>0){
                                // Add server timezone offset to UTC to our stored date
-                       $hoursOffset = date('O',$PA['itemFormElValue'])/100;
-                       $PA['itemFormElValue'] += ($hoursOffset*60*60);
+                       $PA['itemFormElValue'] += date('Z');
                }
 
                $PA['fieldChangeFunc'] = array_merge(array('typo3form.fieldGet'=>'typo3form.fieldGet('.$paramsList.');'), $PA['fieldChangeFunc']);
index 6bc82f1..e94c908 100755 (executable)
@@ -1963,12 +1963,17 @@ class t3lib_TCEmain     {
                        switch($func)   {
                                case 'int':
                                case 'year':
-                               case 'date':
-                               case 'datetime':
                                case 'time':
                                case 'timesec':
                                        $value = intval($value);
                                break;
+                               case 'date':
+                               case 'datetime':
+                                       $value = intval($value);
+                                       if ($value>0)   {
+                                               $value -= date('Z');
+                                       }
+                               break;
                                case 'double2':
                                        $theDec = 0;
                                        for ($a=strlen($value); $a>0; $a--)     {