Skip to content
This repository was archived by the owner on Aug 20, 2019. It is now read-only.

toLocaleDateString() results in "Method invoked on an object that is not Date" error in Chrome #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/MockDate.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ Timecop.MockDate.prototype = {};
// passing all arguments and returning the result.
function defineDelegate(method) {
Timecop.MockDate.prototype[method] = function() {
return this._underlyingDate[method].apply(this._underlyingDate, arguments);
Timecop.uninstall();
var returnVal = this._underlyingDate[method].apply(this._underlyingDate, arguments);
Timecop.install();
return returnVal;
};
}

Expand Down