cjohansen/Sinon.JS — Issue #60: Node.js and useFakeTimers()
Author: philjackson
Created: 2011-11-20 19:52:11+00:00
State: open

Using the following code:

sinon = require "sinon"

console.log( new Date() )

sandbox = sinon.sandbox.create()
sandbox.useFakeTimers()

now = new Date()

console.log( now )
console.log( now.getTime() )
console.log( now.getFullYear() )

sandbox.restore()

console.log( new Date() )

I get this output:

Sun, 20 Nov 2011 19:49:52 GMT
{}
0
1970
Sun, 20 Nov 2011 19:49:52 GMT

It seems that sinon isn't doing the right thing with regards to the `Date` constructor.