summaryrefslogtreecommitdiff
path: root/runtime/js/30_fs.js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-01-27 13:36:36 +0100
committerGitHub <noreply@github.com>2022-01-27 13:36:36 +0100
commit884143218fad0e18f7553aaf079d52de703f7601 (patch)
tree9b9e9d30ea647041438ef8fa974b8d4234cabf73 /runtime/js/30_fs.js
parentdcf8f144ab0516936bfa4e93357d71f1732d880e (diff)
refactor: update runtime code for primordial checks for "instanceof" (#13497)
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;