From dca13b461164d720e1b95ad77edf0d8994bbd89f Mon Sep 17 00:00:00 2001 From: sdjdd Date: Mon, 25 Sep 2023 18:51:41 +0800 Subject: [PATCH] feat: suppress the date string format warning in Weixin DevTools --- src/utils/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils/index.js b/src/utils/index.js index 1d98990b..b9163277 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -91,7 +91,12 @@ const inherits = function inherits(parent, protoProps, staticProps) { return child; }; -const parseDate = iso8601 => new Date(Date.parse(iso8601)); +// Suppress the date string format warning in Weixin DevTools +// Link: https://developers.weixin.qq.com/community/minihome/doc/00080c6f244718053550067736b401 +const parseDate = + typeof wx === 'undefined' + ? iso8601 => new Date(iso8601) + : iso8601 => new Date(Date.parse(iso8601)); const setValue = (target, key, value) => { // '.' is not allowed in Class keys, escaping is not in concern now.