Reputation: 2285
If not a bug, how to tell node my timezone? If bug, is this reported already?
Upvotes: 7
Views: 13672
Reputation: 1475
This is not a bug, just a choice of how Node decides to represent a Date
object in its REPL. Also, as of node v0.7.x
, this output has been changed to display local time, matching the browser behavior:
☮ ~ (master) ⚡ node
> process.version
'v0.7.7'
> new Date
Sat Mar 31 2012 15:12:13 GMT-0700 (PDT)
Upvotes: 5
Reputation: 9817
If it is a bug, it does not exist in my version of Node. It is true that the Node.js REPL prefers to announce in GMT in my version:
> new Date()
Sat, 31 Mar 2012 21:51:47 GMT
But it is in fact timezone-aware, that is just not what the REPL shows when stringifying it:
> new Date().getTimezoneOffset()
-120
> "" + new Date()
'Sat Mar 31 2012 23:51:56 GMT+0200 (CEST)'
(I am running Node.js v0.6.1 on Ubuntu.)
Upvotes: 7