Question

I'm seeing something strange when running PhantomJS through Cygwin versus a windows command prompt. Specifically, the value of a JavaScript Date object returned is different depending on the terminal you running out of.

I'm using a Win7 64bit machine, with PhantomJS 1.9.7 and Cygwin 1.7.28(0.271/5/3).

Results from CYGWIN:

/cygdrive/c
$ phantomjs
phantomjs> var d = new Date("2013/10/01")
undefined
phantomjs> d
"2013-09-30T23:00:00.000Z"

Results from Win CMD:

C:\> phantomjs
phantomjs> var d = new Date("2013/10/01")
undefined
phantomjs> d
"2013-10-01T07:00:00.000Z"

Any idea why CYGWIN would return "2013-09-30T23:00:00.000Z" and CMD returns "2013-10-01T07:00:00.000Z"?

Was it helpful?

Solution

I had the same problem with running phantomjs / poltergeist automated tests under cygwin / babun.

unset TZ

solved the problem, put it in your .zshrc or .bashrc or similar for a permanent fix.

Credit to: localtime returns GMT for windows programs running on cygwin shells

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top