summaryrefslogtreecommitdiff
path: root/runtime/js/30_fs.js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-02-01 18:06:11 +0100
committerGitHub <noreply@github.com>2022-02-01 18:06:11 +0100
commit8176a4d1663529fb8aeebf7734c4994fa1d583f4 (patch)
tree94c7d6eb2679e641f59cf78640340f5b7af0022e /runtime/js/30_fs.js
parentabf89f8c4675ed78c992fafd6d758bf4bfca8a1a (diff)
refactor: primordials for instanceof (#13527)
Diffstat (limited to 'runtime/js/30_fs.js')
-rw-r--r--runtime/js/30_fs.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/js/30_fs.js b/runtime/js/30_fs.js
index bdd575f19..51f2c411e 100644
--- a/runtime/js/30_fs.js
+++ b/runtime/js/30_fs.js
@@ -5,7 +5,9 @@
const core = window.Deno.core;
const {
Date,
+ DatePrototype,
MathTrunc,
+ ObjectPrototypeIsPrototypeOf,
SymbolAsyncIterator,
SymbolIterator,
} = window.__bootstrap.primordials;
@@ -277,7 +279,7 @@
}
function toUnixTimeFromEpoch(value) {
- if (value instanceof Date) {
+ if (ObjectPrototypeIsPrototypeOf(DatePrototype, value)) {
const time = value.valueOf();
const seconds = MathTrunc(time / 1e3);
const nanoseconds = MathTrunc(time - (seconds * 1e3)) * 1e6;