Details
-
Bug
-
Resolution: Done
-
Major - P3
-
None
-
2.1.1
-
None
-
OS X 64bit server with local timezone anything other than UTC
-
ALL
Description
If you use the Date.getDate() function (returns day of month, 1-indexed) in server-side javascript, it seems that timezone conversion into the server's timezone is taking place (here with server in US/Eastern timezone):
> db.eval("function(){ return new ISODate('2012-05-07T00:00:00Z').getDate(); }")
|
6
|
> db.eval("function(){ return new ISODate('2012-05-07T12:00:00Z').getDate(); }")
|
7
|
> db.eval("function(){ return new ISODate('2012-05-07T23:00:00Z').getDate(); }")
|
7
|
Note that the local shell has the same behavior:
> new ISODate('2012-05-07T00:00:00Z').getDate()
|
6
|
> new ISODate('2012-05-07T12:00:00Z').getDate()
|
7
|
> new ISODate('2012-05-07T23:00:00Z').getDate()
|
7
|
I can't tell whether I think the shell ought to do this conversion or not. The server certainly shouldn't.