summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/helpers/test_utils_mock.js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/tests/helpers/test_utils_mock.js')
-rw-r--r--addons/web/static/tests/helpers/test_utils_mock.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/addons/web/static/tests/helpers/test_utils_mock.js b/addons/web/static/tests/helpers/test_utils_mock.js
index 5f567e714bc..8758d162a7b 100644
--- a/addons/web/static/tests/helpers/test_utils_mock.js
+++ b/addons/web/static/tests/helpers/test_utils_mock.js
@@ -446,7 +446,13 @@ function patchDate(year, month, day, hours, minutes, seconds) {
}
// Copy "native" methods explicitly; they may be non-enumerable
- Date.now = NativeDate.now;
+ // exception: 'now' uses fake date as reference
+ Date.now = function () {
+ var date = new NativeDate();
+ var time = date.getTime();
+ time -= timeInterval;
+ return time;
+ };
Date.UTC = NativeDate.UTC;
Date.prototype = NativeDate.prototype;
Date.prototype.constructor = Date;