trifleJS icon indicating copy to clipboard operation
trifleJS copied to clipboard

page.onCallback() does not handle dates

Open sdesalas opened this issue 9 years ago • 1 comments

TrifleJS is using JSON.stringify() to copy objects from IE context to the V8 runtime where test scripts are executed. Thus if you do something like this:

page.onCallback = function(theDate, theType) {
    console.log(theDate, theType);
}

page.evaluate(function(date) {
    window.callPhantom(date, typeof date);
}, new Date());

You will recieve:

  [
      "2015-03-08T03:05:10.294Z",
      "object"
  ]

Meaning that IE gets an object, but sends back a ISO date string.

Please investigate actual behaviour in PhantomJS and add some unit tests.

sdesalas avatar Mar 08 '15 03:03 sdesalas

Actually, this could be related to console.log() which turns dates into date strings..

sdesalas avatar Mar 09 '15 01:03 sdesalas