function RenderDateLocal(oObj)
{
//parse date from python to format Date object understands
var match = oObj.aData[oObj.iDataColumn].match(/^(\d+)-(\d+)-(\d+) (\d+)\:(\d+)\:(\d+)$/);
var localDate = new Date(match[1], match[2] - 1, match[3], match[4], match[5], match[6]);
//take care of timezone offset in minutes to hours by negating and then adding to the hours
var tzo = (localDate.getTimezoneOffset()/60) *-1;
localDate.setHours(localDate.getHours() + tzo );
//reformat date for consistency
var dateStr = localDate.getFullYear() + "-" + (localDate.getMonth() + 1) + "-" + localDate.getDate() + " " + localDate.toLocaleTimeString();
return dateStr;
}
billfor wrote:Looks like fnRender is ignored if used, so the RenderDataLocal never gets called. fnrender has been deprecated from jQuery so you have to use mRender going forward.
The "Live" section never had the problem because the code doesn't actually pull the value from a database -- it just stamps it with your currently time. So there is no transformation there.
Do you want me to file a bug?
fyi if you want to fix it temporarily, find the events.html file and change this line:
{"fnRender": RenderDateLocal },
to
{"mRender": RenderDateLocal },
now because mRender works differently, you also have to change the rendering function.
change
function RenderDateLocal(oObj)
to
function RenderDateLocal(data,type,full)
and change the first line that has the regex matching to:
var match = data.match(/^(\d+)-(\d+)-(\d+) (\d+)\:(\d+)\:(\d+)$/);
function RenderDateLocal(oObj)
{
//parse date from python to format Date object understands
var match = oObj.match(/^(\d+)-(\d+)-(\d+) (\d+)\:(\d+)\:(\d+)$/);
var localDate = new Date(match[1], match[2] - 1, match[3], match[4], match[5], match[6]);
//take care of timezone offset in minutes to hours by negating and then adding to the hours
var tzo = (localDate.getTimezoneOffset()/60) *-1;
localDate.setHours(localDate.getHours() + tzo );
//reformat date for consistency
var dateStr = localDate.getFullYear() + "-" + (localDate.getMonth() + 1) + "-" + localDate.getDate() + " " + localDate.toLocaleTimeString();
return dateStr;
}
Users browsing this forum: No registered users and 3 guests