Project

General

Profile

Bug #18278 » proper-time.diff

Administrator Admin, 2008-02-22 14:52

View differences:

t3lib/class.t3lib_tceforms.php (working copy)
$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){
// Add server timezone offset to UTC to our stored date
$hoursOffset = date('O',$PA['itemFormElValue'])/100;
$PA['itemFormElValue'] += ($hoursOffset*60*60);
}
$PA['fieldChangeFunc'] = array_merge(array('typo3form.fieldGet'=>'typo3form.fieldGet('.$paramsList.');'), $PA['fieldChangeFunc']);
$mLgd = ($config['max']?$config['max']:256);
t3lib/jsfunc.evalfield.js (working copy)
// Substract timezone offset from client
this.lastDate = this.getTimestamp(theTime);
theTime.setTime((this.lastDate - theTime.getTimezoneOffset()*60)*1000);
theTime.setTime(this.lastDate*1000);
this.lastDate = this.getTimestamp(theTime);
}
this.lastDate+=add*24*60*60;
......
var temp = values.values[1];
values = new evalFunc_splitSingle(temp);
}
var sec = (values.values[3])?this.parseInt(values.values[3]):today.getUTCSeconds();
var sec = (values.values[3])?this.parseInt(values.values[3]):today.getSeconds();
if (sec > 59) {sec=59;}
var min = (values.values[2])?this.parseInt(values.values[2]):today.getUTCMinutes();
var min = (values.values[2])?this.parseInt(values.values[2]):today.getMinutes();
if (min > 59) {min=59;}
var hour = (values.values[1])?this.parseInt(values.values[1]):today.getUTCHours();
var hour = (values.values[1])?this.parseInt(values.values[1]):today.getHours();
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(today), today.getMonth(), today.getDate(), hour, min, ((type=="timesec")?sec:0));
this.lastTime = this.getTimestamp(theTime);
theTime.setTime((this.lastTime - theTime.getTimezoneOffset()*60)*1000);
theTime.setTime(this.lastTime*1000);
this.lastTime = this.getTime(theTime);
}
this.lastTime+=add*60;
......
if (!parseInt(value)) {return '';}
var theTime = new Date(parseInt(value) * 1000);
if (this.USmode) {
theString = (theTime.getUTCMonth()+1)+'-'+theTime.getUTCDate()+'-'+this.getYear(theTime);
theString = (theTime.getMonth()+1)+'-'+theTime.getDate()+'-'+this.getYear(theTime);
} else {
theString = theTime.getUTCDate()+'-'+(theTime.getUTCMonth()+1)+'-'+this.getYear(theTime);
theString = theTime.getDate()+'-'+(theTime.getMonth()+1)+'-'+this.getYear(theTime);
}
break;
case "datetime":
......
case "timesec":
if (!parseInt(value)) {return '';}
var theTime = new Date(parseInt(value) * 1000);
var h = theTime.getUTCHours();
var m = theTime.getUTCMinutes();
var s = theTime.getUTCSeconds();
var h = theTime.getHours();
var m = theTime.getMinutes();
var s = theTime.getSeconds();
theString = h+':'+((m<10)?'0':'')+m + ((type=="timesec")?':'+((s<10)?'0':'')+s:'');
break;
case "password":
......
return theString;
}
function evalFunc_getSecs(timeObj) {
return Math.round(timeObj.getUTCSeconds()/1000);
return Math.round(timeObj.getSeconds()/1000);
}
// Seconds since midnight:
function evalFunc_getTime(timeObj) {
return timeObj.getUTCHours()*60*60+timeObj.getUTCMinutes()*60+Math.round(timeObj.getUTCSeconds()/1000);
return timeObj.getHours()*60*60+timeObj.getMinutes()*60+Math.round(timeObj.getSeconds()/1000);
}
function evalFunc_getYear(timeObj) {
return timeObj.getUTCFullYear();
return timeObj.getFullYear();
}
// Seconds since midnight with client timezone offset:
function evalFunc_getTimeSecs(timeObj) {
return timeObj.getHours()*60*60+timeObj.getMinutes()*60+timeObj.getSeconds();
}
function evalFunc_getDate(timeObj) {
var theTime = new Date(this.getYear(timeObj), timeObj.getUTCMonth(), timeObj.getUTCDate());
var theTime = new Date(this.getYear(timeObj), timeObj.getMonth(), timeObj.getDate());
return this.getTimestamp(theTime);
}
function evalFunc_dummy (evallist,is_in,checkbox,checkboxValue) {
typo3/jsfunc.tbe_editor.js (working copy)
var el = split[i].replace(/ /g, '');
if (el == 'datetime' || el == 'date') {
var now = new Date();
checkSetValue = Date.parse(now)/1000 - now.getTimezoneOffset()*60;
checkSetValue = Date.parse(now)/1000;
break;
} else if (el == 'time' || el == 'timesec') {
checkSetValue = evalFunc_getTimeSecs(new Date());
(1-1/3)