From: Ernesto Baschny Date: Fri, 11 Apr 2008 15:43:07 +0000 (+0000) Subject: * Fixed bug #7897: Storage and display of datetime/time fields was broken (one hour... X-Git-Tag: TYPO3_4-2-0RC2~34 X-Git-Url: https://git.typo3.org/Packages/TYPO3.CMS.git/commitdiff_plain/d5995cc7508a148802163586deaf35d3e7642417 * Fixed bug #7897: Storage and display of datetime/time fields was broken (one hour shift) on DST (daylight saving time) changes git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3554 709f56b5-9817-0410-a4d7-c38de5d9e867 --- diff --git a/ChangeLog b/ChangeLog index de24ea2..493e8a5 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-04-11 Ernesto Baschny + + * 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 * Fixed bug #8078: enhance debug stack trace reporting @@ -1208,7 +1212,7 @@ * Feature request #6988: Return errors from performUpdateQueries (Thanks to Francois Suter) -2007-12-19 Ernesto Baschny +2007-12-19 Ernesto Baschny * Feature request #3822, #5065: Make hardcoded (250000 bytes) max attachment size for mailform configurable: $TYPO3_CONF_VARS['FE']['formmailMaxAttachmentSize'] diff --git a/t3lib/class.t3lib_tceforms.php b/t3lib/class.t3lib_tceforms.php index 209eaa1..d810d3f 100755 --- a/t3lib/class.t3lib_tceforms.php +++ b/t3lib/class.t3lib_tceforms.php @@ -1113,9 +1113,9 @@ class t3lib_TCEforms { $cOnClick = 'typo3form.fieldGet('.$paramsList.',1,\''.$checkSetValue.'\');'.implode('',$PA['fieldChangeFunc']); $item.='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']); diff --git a/t3lib/class.t3lib_tcemain.php b/t3lib/class.t3lib_tcemain.php index 142ab35..3ff284f 100755 --- a/t3lib/class.t3lib_tcemain.php +++ b/t3lib/class.t3lib_tcemain.php @@ -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': diff --git a/t3lib/jsfunc.evalfield.js b/t3lib/jsfunc.evalfield.js index 2ac227f..7f89452 100755 --- a/t3lib/jsfunc.evalfield.js +++ b/t3lib/jsfunc.evalfield.js @@ -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);