From edf1fc63407b83f0d204d0cd4a209a2fb54431af Mon Sep 17 00:00:00 2001 From: Zaytsev Kirill Date: Wed, 28 Oct 2020 22:45:11 +0300 Subject: [PATCH] fix: cloning dates in clone util --- src/utils/clone.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/utils/clone.ts b/src/utils/clone.ts index 0492ace..acda4ec 100644 --- a/src/utils/clone.ts +++ b/src/utils/clone.ts @@ -14,7 +14,13 @@ export default function clone (value: any): any { for (const key in value) { if (has(value, key)) { - copy[key] = isScalar(value[key]) ? value[key] : clone(value[key]) + if (isScalar(value[key])) { + copy[key] = value[key] + } else if (value instanceof Date) { + copy[key] = new Date(copy[key]) + } else { + copy[key] = clone(value[key]) + } } }