Closed ubenzer closed 9 years ago
Pretty late, but I guess someone still might get into this issue in the future.
It is not possible to overide [[Class]] internal property to Date: "The value of the [[Class]] internal property of a host object may be any String value except one of "Arguments", "Array", "Boolean", "Date", "Error", "Function", "JSON", "Math", "Number", "Object", "RegExp", and "String"." http://ecma262-5.com/ELS5_Section_8.htm#Section_8.6.2
So I simply overide angular.isDate() function before Date = TimeShift.Date;
angular.isDate = function(x){return x instanceof Date};
Thanks!
Hi,
I am trying to test my code in different timezones using this library in Angular.js. Angular.js checks if an object is a date or not using the following piece:
Before mocking if I call:
it returns `[object Date]
I mock javascript using
window.Date = TimeShift.Date`` After mocking, if I call the same, what I receive isThis is the way Angular.js checks if the given argument is a date or not. Is there way to make TimeShift return [object Date] ?