Skip to content

Commit 83c57d9

Browse files
authored
Merge pull request #945 from dcloudio/fix-datetimepicker-range
fix:修复uni-datetime-picker在datetimerange下选择日期不正确的bug (question/197442)
2 parents 8cb413f + 2cd5a20 commit 83c57d9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -698,11 +698,11 @@
698698
startString = getDateTime(this.start, this.hideSecond)
699699
}
700700
[startDate, startTime] = startString.split(' ')
701-
if (this.start && !dateCompare(this.start, this.tempRange.startDate)) {
701+
if (this.start && !dateCompare(this.start, `${this.tempRange.startDate} ${this.tempRange.startTime}`)) {
702702
startDateLaterRangeStartDate = true
703703
this.tempRange.startDate = startDate
704704
}
705-
if (this.start && !dateCompare(this.start, this.tempRange.endDate)) {
705+
if (this.start && !dateCompare(this.start, `${this.tempRange.endDate} ${this.tempRange.endTime}`)) {
706706
startDateLaterRangeEndDate = true
707707
this.tempRange.endDate = startDate
708708
}
@@ -717,11 +717,11 @@
717717
}
718718
[endDate, endTime] = endString.split(' ')
719719
720-
if (this.end && !dateCompare(this.tempRange.startDate, this.end)) {
720+
if (this.end && !dateCompare(`${this.tempRange.startDate} ${this.tempRange.startTime}`, this.end)) {
721721
endDateEarlierRangeStartDate = true
722722
this.tempRange.startDate = endDate
723723
}
724-
if (this.end && !dateCompare(this.tempRange.endDate, this.end)) {
724+
if (this.end && !dateCompare(`${this.tempRange.endDate} ${this.tempRange.endTime}`, this.end)) {
725725
endDateEarlierRangeEndDate = true
726726
this.tempRange.endDate = endDate
727727
}

0 commit comments

Comments
 (0)