From 50f05ad3addf27827c5657ae7519514e40d9faec Mon Sep 17 00:00:00 2001 From: iamkun Date: Tue, 10 Nov 2020 14:02:35 +0800 Subject: [PATCH] fix: fix customParseFormat plugin parsing date bug (#1198) fix #1194 --- src/plugin/customParseFormat/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugin/customParseFormat/index.js b/src/plugin/customParseFormat/index.js index cc338b0d8..940bb43a5 100644 --- a/src/plugin/customParseFormat/index.js +++ b/src/plugin/customParseFormat/index.js @@ -133,7 +133,7 @@ function correctHours(time) { } function makeParser(format) { - format = u(format, locale.formats) + format = u(format, locale && locale.formats) const array = format.match(formattingTokens) const { length } = array for (let i = 0; i < length; i += 1) { @@ -224,6 +224,8 @@ export default (o, C, d) => { if (isStrict && date !== this.format(format)) { this.$d = new Date('') } + // reset global locale to make parallel unit test + locale = undefined } else if (format instanceof Array) { const len = format.length for (let i = 1; i <= len; i += 1) {