From 3c91972edbc4ebef9f621c8b7ae47d4f880d8935 Mon Sep 17 00:00:00 2001 From: "stan.yang" Date: Mon, 13 Jan 2025 18:47:29 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-146679=20fix:=20=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=A0=BC=E5=BC=8F=E6=97=B6check=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/src/widget/timeinterval/dateinterval.js | 3 ++- packages/fineui/src/widget/timeinterval/timeinterval.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/fineui/src/widget/timeinterval/dateinterval.js b/packages/fineui/src/widget/timeinterval/dateinterval.js index 5f1aaef77..43386d331 100644 --- a/packages/fineui/src/widget/timeinterval/dateinterval.js +++ b/packages/fineui/src/widget/timeinterval/dateinterval.js @@ -181,7 +181,8 @@ export class DateInterval extends Single { print(parseDateTime(date, "%Y-%x-%d"), "%Y-%x-%d") === date || print(parseDateTime(date, "%Y-%X-%d"), "%Y-%X-%d") === date || print(parseDateTime(date, "%Y-%x-%e"), "%Y-%x-%e") === date || - print(parseDateTime(date, "%Y-%X-%e"), "%Y-%X-%e") === date + print(parseDateTime(date, "%Y-%X-%e"), "%Y-%X-%e") === date || + print(parseDateTime(date, this.options.format), this.options.format) === date ); } diff --git a/packages/fineui/src/widget/timeinterval/timeinterval.js b/packages/fineui/src/widget/timeinterval/timeinterval.js index 11808d69c..e5c9afe3e 100644 --- a/packages/fineui/src/widget/timeinterval/timeinterval.js +++ b/packages/fineui/src/widget/timeinterval/timeinterval.js @@ -197,7 +197,8 @@ export class TimeInterval extends Single { print(parseDateTime(date, "%Y-%x-%d %H:%M:%S"), "%Y-%x-%d %H:%M:%S") === date || print(parseDateTime(date, "%Y-%X-%d %H:%M:%S"), "%Y-%X-%d %H:%M:%S") === date || print(parseDateTime(date, "%Y-%x-%e %H:%M:%S"), "%Y-%x-%e %H:%M:%S") === date || - print(parseDateTime(date, "%Y-%X-%e %H:%M:%S"), "%Y-%X-%e %H:%M:%S") === date + print(parseDateTime(date, "%Y-%X-%e %H:%M:%S"), "%Y-%X-%e %H:%M:%S") === date || + print(parseDateTime(date, this.options.format), this.options.format) === date ); } From e3899c69626e2aa55040184458906970ad4ab1df Mon Sep 17 00:00:00 2001 From: "stan.yang" Date: Tue, 14 Jan 2025 15:57:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-146679=20fix:=20=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=A0=BC=E5=BC=8F=E7=89=B9=E6=AE=8A=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/widget/timeinterval/dateinterval.js | 17 ++++++++++------- .../src/widget/timeinterval/timeinterval.js | 17 ++++++++++------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/packages/fineui/src/widget/timeinterval/dateinterval.js b/packages/fineui/src/widget/timeinterval/dateinterval.js index 43386d331..964c44f3a 100644 --- a/packages/fineui/src/widget/timeinterval/dateinterval.js +++ b/packages/fineui/src/widget/timeinterval/dateinterval.js @@ -193,19 +193,22 @@ export class DateInterval extends Single { } _check(smallDate, bigDate) { - const smallObj = smallDate.match(/\d+/g), - bigObj = bigDate.match(/\d+/g); - + // 现在有自定义样式,所以有["%X", "%d", "%Y"]这种不是[year, month, day]的情况,下面取对应的ymd就出错 + // 所以先把这个string转成date,再转成默认格式string,只对自定义格式的date做处理 + const newSmallDate = this.options.format ? print(parseDateTime(smallDate, this.options.format), "%Y-%X-%d %H:%M:%S") : smallDate; + const newBigDate = this.options.format ? print(parseDateTime(bigDate, this.options.format), "%Y-%X-%d %H:%M:%S") : bigDate; + const smallObj = newSmallDate.match(/\d+/g), + bigObj = newBigDate.match(/\d+/g); return ( - this._dateCheck(smallDate) && - checkDateLegal(smallDate) && + this._dateCheck(newSmallDate) && + checkDateLegal(newSmallDate) && this._checkVoid({ year: smallObj[0], month: smallObj[1], day: smallObj[2], }) && - this._dateCheck(bigDate) && - checkDateLegal(bigDate) && + this._dateCheck(newBigDate) && + checkDateLegal(newBigDate) && this._checkVoid({ year: bigObj[0], month: bigObj[1], diff --git a/packages/fineui/src/widget/timeinterval/timeinterval.js b/packages/fineui/src/widget/timeinterval/timeinterval.js index e5c9afe3e..678115c80 100644 --- a/packages/fineui/src/widget/timeinterval/timeinterval.js +++ b/packages/fineui/src/widget/timeinterval/timeinterval.js @@ -209,19 +209,22 @@ export class TimeInterval extends Single { } _check(smallDate, bigDate) { - const smallObj = smallDate.match(/\d+/g), - bigObj = bigDate.match(/\d+/g); - + // 现在有自定义样式,所以有["%X", "%d", "%Y"]这种不是[year, month, day]的情况,下面取对应的ymd就出错 + // 所以先把这个string转成date,再转成默认格式string,只对自定义格式的date做处理 + const newSmallDate = this.options.format ? print(parseDateTime(smallDate, this.options.format), "%Y-%X-%d %H:%M:%S") : smallDate; + const newBigDate = this.options.format ? print(parseDateTime(bigDate, this.options.format), "%Y-%X-%d %H:%M:%S") : bigDate; + const smallObj = newSmallDate.match(/\d+/g), + bigObj = newBigDate.match(/\d+/g); return ( - this._dateCheck(smallDate) && - checkDateLegal(smallDate) && + this._dateCheck(newSmallDate) && + checkDateLegal(newSmallDate) && this._checkVoid({ year: smallObj[0], month: smallObj[1], day: smallObj[2], }) && - this._dateCheck(bigDate) && - checkDateLegal(bigDate) && + this._dateCheck(newBigDate) && + checkDateLegal(newBigDate) && this._checkVoid({ year: bigObj[0], month: bigObj[1],