I have a php script that generates a date object from a database value like this:
$dt = new DateTime($string_from_database); // In YYYY-mm-dd format
$jsonValue = $dt->format('U');
This is retrieved by my JS using AJAX. I feed it into a jQuery table like this:
//DateStart
{
'sName': 'date_start',
'iDataSort': 2,
'bSearchable': false,
'fnRender': function(obj) {
var dStart = new Date(parseInt(obj.aData['DateStartJson']) * 1000);
var dEnd = new Date(parseInt(obj.aData['DateEndJson']) * 1000);
if (obj.aData['DateStartJson'] == obj.aData['DateEndJson'])
return dStart.toDateString().substr(4);
else
return dStart.toDateString().substr(4) + ' -<br/>' + dEnd.toDateString().substr(4);
}
},
Some users are reporting that the JS time displayed is a day earlier than the date as displayed via PHP directly.
PHP displays: Aug 24, 2013 JS displays: Aug 23, 2013
Note: This happens only with some users, and I cannot reproduce it locally.
Any ideas? Jared