From 2afabd29c289b2b293c7b97ec30da98fee33fc9b Mon Sep 17 00:00:00 2001
From: ddx2019 <49276771+ddx2019@users.noreply.github.com>
Date: Tue, 29 Oct 2024 14:56:53 +0800
Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8Duni-datetime-picker?=
 =?UTF-8?q?=E5=9C=A8IOS=E4=B8=8A=E4=BC=A0=E2=80=98YYYY-MM-DD=E2=80=99?=
 =?UTF-8?q?=E4=B8=8D=E7=94=9F=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../uni-datetime-picker/uni-datetime-picker.vue  | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue
index 9f6102f4..2c182968 100644
--- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue
+++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue
@@ -692,17 +692,25 @@
 				let startDateLaterRangeStartDate = false
 				let startDateLaterRangeEndDate = false
 				let startDate, startTime
+
+				let compareStartDateString = this.tempRange.startDate
+				let compareEndDateString = this.tempRange.endDate
+				if (this.hasTime) {
+					compareStartDateString = `${this.tempRange.startDate} ${this.tempRange.startTime}`
+					compareEndDateString = `${this.tempRange.endDate} ${this.tempRange.endTime}`
+				}
+
 				if (this.start) {
 					let startString = this.start
 					if (typeof this.start === 'number') {
 						startString = getDateTime(this.start, this.hideSecond)
 					}
 					[startDate, startTime] = startString.split(' ')
-					if (this.start && !dateCompare(this.start, `${this.tempRange.startDate} ${this.tempRange.startTime}`)) {
+					if (this.start && !dateCompare(this.start, compareStartDateString)) {
 						startDateLaterRangeStartDate = true
 						this.tempRange.startDate = startDate
 					}
-					if (this.start && !dateCompare(this.start, `${this.tempRange.endDate} ${this.tempRange.endTime}`)) {
+					if (this.start && !dateCompare(this.start, compareEndDateString)) {
 						startDateLaterRangeEndDate = true
 						this.tempRange.endDate = startDate
 					}
@@ -717,11 +725,11 @@
 					}
 					[endDate, endTime] = endString.split(' ')
 
-					if (this.end && !dateCompare(`${this.tempRange.startDate} ${this.tempRange.startTime}`, this.end)) {
+					if (this.end && !dateCompare(compareStartDateString, this.end)) {
 						endDateEarlierRangeStartDate = true
 						this.tempRange.startDate = endDate
 					}
-					if (this.end && !dateCompare(`${this.tempRange.endDate} ${this.tempRange.endTime}`, this.end)) {
+					if (this.end && !dateCompare(compareEndDateString, this.end)) {
 						endDateEarlierRangeEndDate = true
 						this.tempRange.endDate = endDate
 					}