111
This commit is contained in:
@@ -1,20 +1,22 @@
|
||||
## 2.2.25(2023-10-18)
|
||||
- 修复 PC端初次修改时间,开始时间未更新的Bug [详情](https://github.com/dcloudio/uni-ui/issues/737)
|
||||
## 2.2.24(2023-06-02)
|
||||
- 修复 部分情况修改时间,开始、结束时间显示异常的Bug [详情](https://ask.dcloud.net.cn/question/171146)
|
||||
- 优化 当前月可以选择上月、下月的日期
|
||||
- 优化 当前月可以选择上月、下月的日期的Bug
|
||||
## 2.2.23(2023-05-02)
|
||||
- 修复 部分情况修改时间,开始时间未更新 [详情](https://github.com/dcloudio/uni-ui/issues/737)
|
||||
- 修复 部分平台及设备第一次点击无法显示弹框
|
||||
- 修复 ios 日期格式未补零显示及使用异常 [详情](https://ask.dcloud.net.cn/question/162979)
|
||||
- 修复 部分情况修改时间,开始时间未更新的Bug [详情](https://github.com/dcloudio/uni-ui/issues/737)
|
||||
- 修复 部分平台及设备第一次点击无法显示弹框的Bug
|
||||
- 修复 ios 日期格式未补零显示及使用异常的Bug [详情](https://ask.dcloud.net.cn/question/162979)
|
||||
## 2.2.22(2023-03-30)
|
||||
- 修复 日历 picker 修改年月后,自动选中当月1日 [详情](https://ask.dcloud.net.cn/question/165937)
|
||||
- 修复 小程序端 低版本 ios NaN [详情](https://ask.dcloud.net.cn/question/162979)
|
||||
- 修复 日历 picker 修改年月后,自动选中当月1日的Bug [详情](https://ask.dcloud.net.cn/question/165937)
|
||||
- 修复 小程序端 低版本 ios NaN的Bug [详情](https://ask.dcloud.net.cn/question/162979)
|
||||
## 2.2.21(2023-02-20)
|
||||
- 修复 firefox 浏览器显示区域点击无法拉起日历弹框的Bug [详情](https://ask.dcloud.net.cn/question/163362)
|
||||
## 2.2.20(2023-02-17)
|
||||
- 优化 值为空依然选中当天问题
|
||||
- 优化 提供 default-value 属性支持配置选择器打开时默认显示的时间
|
||||
- 优化 非范围选择未选择日期时间,点击确认按钮选中当前日期时间
|
||||
- 优化 字节小程序日期时间范围选择,底部日期换行问题
|
||||
- 优化 字节小程序日期时间范围选择,底部日期换行的Bug
|
||||
## 2.2.19(2023-02-09)
|
||||
- 修复 2.2.18 引起范围选择配置 end 选择无效的Bug [详情](https://github.com/dcloudio/uni-ui/issues/686)
|
||||
## 2.2.18(2023-02-08)
|
||||
|
||||
@@ -586,7 +586,6 @@
|
||||
this.tempSingleDate = this.calendar.fullDate
|
||||
const beforeDate = new Date(this.cale.multipleStatus.before).getTime()
|
||||
const afterDate = new Date(this.cale.multipleStatus.after).getTime()
|
||||
// 如果先选择结束日期,后选择开始日期,需要交换
|
||||
if (beforeDate > afterDate && afterDate) {
|
||||
this.tempRange.before = this.cale.multipleStatus.after
|
||||
this.tempRange.after = this.cale.multipleStatus.before
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
<view class="uni-date">
|
||||
<view class="uni-date-editor" @click="show">
|
||||
<slot>
|
||||
<view
|
||||
class="uni-date-editor--x"
|
||||
:class="{'uni-date-editor--x__disabled': disabled,'uni-date-x--border': border}"
|
||||
>
|
||||
<view class="uni-date-editor--x"
|
||||
:class="{'uni-date-editor--x__disabled': disabled,'uni-date-x--border': border}">
|
||||
<view v-if="!isRange" class="uni-date-x uni-date-single">
|
||||
<uni-icons class="icon-calendar" type="calendar" color="#c0c4cc" size="22"></uni-icons>
|
||||
<view class="uni-date__x-input">{{ displayValue || singlePlaceholderText }}</view>
|
||||
@@ -13,11 +11,15 @@
|
||||
|
||||
<view v-else class="uni-date-x uni-date-range">
|
||||
<uni-icons class="icon-calendar" type="calendar" color="#c0c4cc" size="22"></uni-icons>
|
||||
<view class="uni-date__x-input text-center">{{ displayRangeValue.startDate || startPlaceholderText }}</view>
|
||||
<view class="uni-date__x-input text-center">
|
||||
{{ displayRangeValue.startDate || startPlaceholderText }}
|
||||
</view>
|
||||
|
||||
<view class="range-separator">{{rangeSeparator}}</view>
|
||||
|
||||
<view class="uni-date__x-input text-center">{{ displayRangeValue.endDate || endPlaceholderText }}</view>
|
||||
<view class="uni-date__x-input text-center">
|
||||
{{ displayRangeValue.endDate || endPlaceholderText }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="showClearIcon" class="uni-date__icon-clear" @click.stop="clear">
|
||||
@@ -38,16 +40,16 @@
|
||||
:placeholder="selectDateText" />
|
||||
|
||||
<time-picker type="time" v-model="pickerTime" :border="false" :disabled="!inputDate"
|
||||
:start="timepickerStartTime" :end="timepickerEndTime" :hideSecond="hideSecond" style="width: 100%;">
|
||||
<input class="uni-date__input text-center" type="text" v-model="pickerTime" :placeholder="selectTimeText"
|
||||
:disabled="!inputDate" />
|
||||
:start="timepickerStartTime" :end="timepickerEndTime" :hideSecond="hideSecond"
|
||||
style="width: 100%;">
|
||||
<input class="uni-date__input text-center" type="text" v-model="pickerTime"
|
||||
:placeholder="selectTimeText" :disabled="!inputDate" />
|
||||
</time-picker>
|
||||
</view>
|
||||
|
||||
<Calendar ref="pcSingle" :showMonth="false" :start-date="calendarRange.startDate"
|
||||
:end-date="calendarRange.endDate" :date="calendarDate" @change="singleChange"
|
||||
:default-value="defaultValue"
|
||||
style="padding: 0 8px;" />
|
||||
:default-value="defaultValue" style="padding: 0 8px;" />
|
||||
|
||||
<view v-if="hasTime" class="popup-x-footer">
|
||||
<text class="confirm-text" @click="confirmSingleChange">{{okText}}</text>
|
||||
@@ -61,8 +63,8 @@
|
||||
<input class="uni-date__input uni-date-range__input" type="text" v-model="tempRange.startDate"
|
||||
:placeholder="startDateText" />
|
||||
|
||||
<time-picker type="time" v-model="tempRange.startTime" :start="timepickerStartTime" :border="false"
|
||||
:disabled="!tempRange.startDate" :hideSecond="hideSecond">
|
||||
<time-picker type="time" v-model="tempRange.startTime" :start="timepickerStartTime"
|
||||
:border="false" :disabled="!tempRange.startDate" :hideSecond="hideSecond">
|
||||
<input class="uni-date__input uni-date-range__input" type="text"
|
||||
v-model="tempRange.startTime" :placeholder="startTimeText"
|
||||
:disabled="!tempRange.startDate" />
|
||||
@@ -102,8 +104,7 @@
|
||||
|
||||
<Calendar v-if="isPhone" ref="mobile" :clearDate="false" :date="calendarDate" :defTime="mobileCalendarTime"
|
||||
:start-date="calendarRange.startDate" :end-date="calendarRange.endDate" :selectableTimes="mobSelectableTime"
|
||||
:startPlaceholder="startPlaceholder" :endPlaceholder="endPlaceholder"
|
||||
:default-value="defaultValue"
|
||||
:startPlaceholder="startPlaceholder" :endPlaceholder="endPlaceholder" :default-value="defaultValue"
|
||||
:pleStatus="endMultipleStatus" :showMonth="false" :range="isRange" :hasTime="hasTime" :insert="false"
|
||||
:hideSecond="hideSecond" @confirm="mobileChange" @maskClose="close" />
|
||||
</view>
|
||||
@@ -133,9 +134,19 @@
|
||||
**/
|
||||
import Calendar from './calendar.vue'
|
||||
import TimePicker from './time-picker.vue'
|
||||
import { initVueI18n } from '@dcloudio/uni-i18n'
|
||||
import {
|
||||
initVueI18n
|
||||
} from '@dcloudio/uni-i18n'
|
||||
import i18nMessages from './i18n/index.js'
|
||||
import { getDateTime, getDate, getTime, getDefaultSecond, dateCompare, checkDate, fixIosDateFormat } from './util'
|
||||
import {
|
||||
getDateTime,
|
||||
getDate,
|
||||
getTime,
|
||||
getDefaultSecond,
|
||||
dateCompare,
|
||||
checkDate,
|
||||
fixIosDateFormat
|
||||
} from './util'
|
||||
|
||||
export default {
|
||||
name: 'UniDatetimePicker',
|
||||
@@ -373,7 +384,8 @@
|
||||
return this.i18nT("uni-datetime-picker.clear")
|
||||
},
|
||||
showClearIcon() {
|
||||
return this.clearIcon && !this.disabled && (this.displayValue || (this.displayRangeValue.startDate && this.displayRangeValue.endDate))
|
||||
return this.clearIcon && !this.disabled && (this.displayValue || (this.displayRangeValue.startDate && this
|
||||
.displayRangeValue.endDate))
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@@ -454,7 +466,9 @@
|
||||
this.isPhone = navigator.userAgent.toLowerCase().indexOf('mobile') !== -1
|
||||
return
|
||||
}
|
||||
const { windowWidth } = uni.getSystemInfoSync()
|
||||
const {
|
||||
windowWidth
|
||||
} = uni.getSystemInfoSync()
|
||||
this.isPhone = windowWidth <= 500
|
||||
this.windowWidth = windowWidth
|
||||
},
|
||||
@@ -492,7 +506,9 @@
|
||||
}
|
||||
} else {
|
||||
this.$refs.right.changeMonth('next')
|
||||
this.$refs.right.cale.lastHover = false
|
||||
if (this.isPhone) {
|
||||
this.$refs.right.cale.lastHover = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -624,7 +640,10 @@
|
||||
},
|
||||
mobileChange(e) {
|
||||
if (this.isRange) {
|
||||
const {before, after} = e.range
|
||||
const {
|
||||
before,
|
||||
after
|
||||
} = e.range
|
||||
|
||||
if (!before || !after) {
|
||||
return
|
||||
@@ -818,6 +837,7 @@
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.uni-date-x {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
@@ -832,6 +852,7 @@
|
||||
.icon-calendar {
|
||||
padding-left: 3px;
|
||||
}
|
||||
|
||||
.range-separator {
|
||||
height: 35px;
|
||||
/* #ifndef MP */
|
||||
@@ -871,7 +892,7 @@
|
||||
position: relative;
|
||||
flex: 1;
|
||||
line-height: 35px;
|
||||
font-size: 14px;
|
||||
font-size: 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,36 +96,11 @@ class Calendar {
|
||||
getPreMonthDays(amount, dateObj) {
|
||||
const result = []
|
||||
for (let i = amount - 1; i >= 0; i--) {
|
||||
const month = dateObj.month > 1 ? dateObj.month -1 : 12
|
||||
const year = month === 12 ? dateObj.year - 1 : dateObj.year
|
||||
const date = new Date(year,month,-i).getDate()
|
||||
const fullDate = `${year}-${addZero(month)}-${addZero(date)}`
|
||||
let multiples = this.multipleStatus.data
|
||||
let multiplesStatus = -1
|
||||
if (this.range && multiples) {
|
||||
multiplesStatus = multiples.findIndex((item) => {
|
||||
return this.dateEqual(item, fullDate)
|
||||
})
|
||||
}
|
||||
const checked = multiplesStatus !== -1
|
||||
// 获取打点信息
|
||||
const extraInfo = this.selected && this.selected.find((item) => {
|
||||
if (this.dateEqual(fullDate, item.date)) {
|
||||
return item
|
||||
}
|
||||
})
|
||||
const month = dateObj.month - 1
|
||||
result.push({
|
||||
fullDate,
|
||||
year,
|
||||
date: new Date(dateObj.year, month, -i).getDate(),
|
||||
month,
|
||||
date,
|
||||
multiple: this.range ? checked : false,
|
||||
beforeMultiple: this.isLogicBefore(fullDate, this.multipleStatus.before, this.multipleStatus.after),
|
||||
afterMultiple: this.isLogicAfter(fullDate, this.multipleStatus.before, this.multipleStatus.after),
|
||||
disable: (this.startDate && !dateCompare(this.startDate, fullDate)) || (this.endDate && !dateCompare(fullDate,this.endDate)),
|
||||
isToday: fullDate === this.date.fullDate,
|
||||
userChecked: false,
|
||||
extraInfo
|
||||
disable: true
|
||||
})
|
||||
}
|
||||
return result
|
||||
@@ -140,7 +115,7 @@ class Calendar {
|
||||
const currentDate = `${dateObj.year}-${dateObj.month}-${addZero(i)}`
|
||||
const isToday = fullDate === currentDate
|
||||
// 获取打点信息
|
||||
const extraInfo = this.selected && this.selected.find((item) => {
|
||||
const info = this.selected && this.selected.find((item) => {
|
||||
if (this.dateEqual(currentDate, item.date)) {
|
||||
return item
|
||||
}
|
||||
@@ -169,15 +144,15 @@ class Calendar {
|
||||
result.push({
|
||||
fullDate: currentDate,
|
||||
year: dateObj.year,
|
||||
month: dateObj.month,
|
||||
date: i,
|
||||
multiple: this.range ? checked : false,
|
||||
beforeMultiple: this.isLogicBefore(currentDate, this.multipleStatus.before, this.multipleStatus.after),
|
||||
afterMultiple: this.isLogicAfter(currentDate, this.multipleStatus.before, this.multipleStatus.after),
|
||||
month: dateObj.month,
|
||||
disable: (this.startDate && !dateCompare(this.startDate, currentDate)) || (this.endDate && !dateCompare(currentDate,this.endDate)),
|
||||
isToday,
|
||||
userChecked: false,
|
||||
extraInfo
|
||||
extraInfo: info
|
||||
})
|
||||
}
|
||||
return result
|
||||
@@ -189,35 +164,10 @@ class Calendar {
|
||||
const result = []
|
||||
const month = dateObj.month + 1
|
||||
for (let i = 1; i <= amount; i++) {
|
||||
const month = dateObj.month === 12 ? 1 : dateObj.month*1 + 1
|
||||
const year = month === 1 ? dateObj.year + 1 : dateObj.year
|
||||
const fullDate = `${year}-${addZero(month)}-${addZero(i)}`
|
||||
let multiples = this.multipleStatus.data
|
||||
let multiplesStatus = -1
|
||||
if (this.range && multiples) {
|
||||
multiplesStatus = multiples.findIndex((item) => {
|
||||
return this.dateEqual(item, fullDate)
|
||||
})
|
||||
}
|
||||
const checked = multiplesStatus !== -1
|
||||
// 获取打点信息
|
||||
const extraInfo = this.selected && this.selected.find((item) => {
|
||||
if (this.dateEqual(fullDate, item.date)) {
|
||||
return item
|
||||
}
|
||||
})
|
||||
result.push({
|
||||
fullDate,
|
||||
year,
|
||||
date: i,
|
||||
month,
|
||||
multiple: this.range ? checked : false,
|
||||
beforeMultiple: this.isLogicBefore(fullDate, this.multipleStatus.before, this.multipleStatus.after),
|
||||
afterMultiple: this.isLogicAfter(fullDate, this.multipleStatus.before, this.multipleStatus.after),
|
||||
disable: (this.startDate && !dateCompare(this.startDate, fullDate)) || (this.endDate && !dateCompare(fullDate,this.endDate)),
|
||||
isToday: fullDate === this.date.fullDate,
|
||||
userChecked: false,
|
||||
extraInfo
|
||||
disable: true
|
||||
})
|
||||
}
|
||||
return result
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "uni-datetime-picker",
|
||||
"displayName": "uni-datetime-picker 日期选择器",
|
||||
"version": "2.2.24",
|
||||
"version": "2.2.25",
|
||||
"description": "uni-datetime-picker 日期时间选择器,支持日历,支持范围选择",
|
||||
"keywords": [
|
||||
"uni-datetime-picker",
|
||||
|
||||
Reference in New Issue
Block a user