* Fixed bug #7897: Storage and display of datetime/time fields was broken (one hour...
authorErnesto Baschny <ernst@cron-it.de>
Fri, 11 Apr 2008 15:43:07 +0000 (15:43 +0000)
committerErnesto Baschny <ernst@cron-it.de>
Fri, 11 Apr 2008 15:43:07 +0000 (15:43 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3554 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_tceforms.php
t3lib/class.t3lib_tcemain.php
t3lib/jsfunc.evalfield.js

index de24ea2..493e8a5 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-04-11  Ernesto Baschny  <ernst@cron-it.de>
+
+       * Fixed bug #7897: Storage and display of datetime/time fields was broken (one hour shift) on DST (daylight saving time) changes
+
 2008-04-11  Dmitry Dulepov  <dmitry@typo3.org>
 
        * Fixed bug #8078: enhance debug stack trace reporting
 
        * Feature request #6988: Return errors from performUpdateQueries (Thanks to Francois Suter)
 
-2007-12-19  Ernesto Baschny <ernst@cron-it.de>
+2007-12-19  Ernesto Baschny  <ernst@cron-it.de>
 
        * Feature request #3822, #5065: Make hardcoded (250000 bytes) max attachment size for mailform configurable: $TYPO3_CONF_VARS['FE']['formmailMaxAttachmentSize']
 
index 209eaa1..d810d3f 100755 (executable)
@@ -1113,9 +1113,9 @@ class t3lib_TCEforms      {
                        $cOnClick = 'typo3form.fieldGet('.$paramsList.',1,\''.$checkSetValue.'\');'.implode('',$PA['fieldChangeFunc']);
                        $item.='<input type="checkbox"'.$this->insertDefStyle('check').' name="'.$PA['itemFormElName'].'_cb" onclick="'.htmlspecialchars($cOnClick).'" />';
                }
-               if((in_array('date',$evalList) || in_array('datetime',$evalList)) && $PA['itemFormElValue']>0){
+               if ((in_array('date',$evalList) || in_array('datetime',$evalList)) && $PA['itemFormElValue']>0){
                                // Add server timezone offset to UTC to our stored date
-                       $PA['itemFormElValue'] += date('Z');
+                       $PA['itemFormElValue'] += date('Z', $PA['itemFormElValue']);
                }
 
                $PA['fieldChangeFunc'] = array_merge(array('typo3form.fieldGet'=>'typo3form.fieldGet('.$paramsList.');'), $PA['fieldChangeFunc']);
index 142ab35..3ff284f 100755 (executable)
@@ -2017,7 +2017,7 @@ class t3lib_TCEmain       {
                                case 'datetime':
                                        $value = intval($value);
                                        if ($value>0)   {
-                                               $value -= date('Z');
+                                               $value -= date('Z', $value);
                                        }
                                break;
                                case 'double2':
index 2ac227f..7f89452 100755 (executable)
@@ -49,6 +49,7 @@ function evalFunc()   {
        this.lastYear = this.getYear(today);
        this.lastDate = this.getDate(today);
        this.lastTime = this.getTimestamp(today);
+       this.refDate = today;
        this.isInString = '';
        this.USmode = 0;
 }
@@ -279,7 +280,10 @@ function evalFunc_input(type,inVal)        {
                                default:
                                        var index = value.indexOf(' ');
                                        if (index!=-1)  {
-                                               this.lastTime = this.input("date",value.substr(index,value.length)) + this.input("time",value.substr(0,index));
+                                               var dateVal = this.input("date",value.substr(index,value.length));
+                                                       // set refDate so that evalFunc_input on time will work with correct DST information
+                                               this.refDate = new Date(dateVal*1000);
+                                               this.lastTime = dateVal + this.input("time",value.substr(0,index));
                                        }
                        }
                        this.lastTime+=add*24*60*60;
@@ -401,7 +405,7 @@ function evalFunc_input(type,inVal) {
                                        var hour = (values.values[1])?this.parseInt(values.values[1]):today.getUTCHours();
                                        if (hour > 23)  {hour=23;}
 
-                                       var theTime = new Date(this.getYear(today), today.getUTCMonth(), today.getUTCDate(), hour, min, ((type=="timesec")?sec:0));
+                                       var theTime = new Date(this.getYear(this.refDate), this.refDate.getUTCMonth(), this.refDate.getUTCDate(), hour, min, ((type=="timesec")?sec:0));
 
                                        this.lastTime = this.getTimestamp(theTime);
                                        theTime.setTime((this.lastTime - theTime.getTimezoneOffset()*60)*1000);