Date
Closed this issue · 4 comments
Deleted user commented
I wanted to add the native Date like in issue #6: addGlobal('Date',Date')
.
Usingnew Date
works (new Date('December 25, 1995 23:15:30');
) but methods aren't working ( Xmas95.getMonth()
).
var Xmas95 = new Date('December 25, 1995 23:15:30'); // works
var month = Xmas95.getMonth(); // doesn't work
console.log(month);
Is there a way to expose the methods?
basicer commented
The crux of the issue here is that the Date() constructor knows if its being called as a constructor or not. I just pushed some code to fix this. ef34f6a
Leaving this open so I remember to write some tests to cover it.
Deleted user commented
basicer commented
Good catch. Should have written the tests first :D. Try now.
Deleted user commented
Thanks it's working now.