From d330ad6254306c3083fcbd892c4a1d87f658cde1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=88=B4=E5=87=AF=E6=9D=B0?= Date: Sun, 6 Dec 2020 11:57:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96replacer=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E5=85=B3=E4=BA=8EDate=E7=B1=BB=E5=9E=8B=E7=9A=84=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/common/json.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/common/json.ts b/core/common/json.ts index 71e1cde..7b3e05d 100644 --- a/core/common/json.ts +++ b/core/common/json.ts @@ -10,9 +10,8 @@ export function reviver(key, value) { } export function replacer(key, value) { - if (typeof value === 'string') - if (ISO8601Regex.exec(value)) - return dayjs(value).format("YYYY-MM-DDTHH:mm:ss.SSSZ"); + if (this[key] instanceof Date) + return dayjs(value).format("YYYY-MM-DDTHH:mm:ss.SSSZ"); return value; }