Skip to content

Commit 795fd91

Browse files
fix(proxy-state-tree): prevent proxying Date instances
1 parent b20d22e commit 795fd91

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/node_modules/proxy-state-tree/src/Proxyfier.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export class Proxifier {
174174
prop === 'length' ||
175175
(typeof target[prop] === 'function' &&
176176
!arrayMutations.has(String(prop))) ||
177-
typeof prop === 'symbol'
177+
typeof prop === 'symbol' || target[prop] instanceof Date
178178
) {
179179
return target[prop]
180180
}
@@ -272,7 +272,7 @@ export class Proxifier {
272272
if (prop === VALUE) return object
273273
if (prop === PROXY_TREE) return proxifier.tree
274274

275-
if (typeof prop === 'symbol' || prop in Object.prototype)
275+
if (typeof prop === 'symbol' || prop in Object.prototype || target[prop] instanceof Date)
276276
return target[prop]
277277

278278
const descriptor = Object.getOwnPropertyDescriptor(target, prop) || Object.getOwnPropertyDescriptor(Object.getPrototypeOf(target), prop)

0 commit comments

Comments
 (0)