提交 3a9f0604 authored 作者: pengxiaohui's avatar pengxiaohui

时间24点边界处理

上级 7d0004d1
......@@ -12,7 +12,10 @@
<p>
<i class="el-icon-time"></i>时间:
<span v-if="isSameDate">{{ev.start_time | timeFormat('{m}月{d}日')}} {{ev.end_time | timeFormat('周{a}')}} {{ev.start_time | timeFormat}}-{{ev.end_time | timeFormat}}</span>
<span v-else>{{ev.start_time | timeFormat('{m}月{d}日 {h}:{i}')}} - {{ev.start_time | timeFormat('{m}月{d}日 {h}:{i}')}}</span>
<template v-else>
<span v-if="isEndTimeZeroPoint">{{ev.start_time | timeFormat('{m}月{d}日 {h}:{i}')}} - 24:00</span>
<span v-else>{{ev.start_time | timeFormat('{m}月{d}日 {h}:{i}')}} - {{ev.end_time | timeFormat('{m}月{d}日 {h}:{i}')}}</span>
</template>
</p>
<p>
<i class="el-icon-user"></i>创建人
......@@ -42,6 +45,9 @@ export default {
},
isSameDate() {
return dateFormat(this.ev.start_time, '{m}-{d}') === dateFormat(this.ev.end_time, '{m}-{d}')
},
isEndTimeZeroPoint() {
return dateFormat(this.ev.end_time, '{h}:{i}') === '00:00'
}
},
created() {
......
......@@ -140,7 +140,7 @@ export default {
}
},
endDateShowFormat() {
const date = this.form.startDate
const date = this.form.endDate
if (typeof date === 'object' && date instanceof Date) {
return 'yyyy-MM-dd 周' + dateFormat(date, '{a}')
} else {
......@@ -173,26 +173,36 @@ export default {
return options
},
endDateOptions() {
const _startDate = this.form.startDate;
const date = this.form.startDate;
return {
disabledDate(time) {
return getTimestampYMD(time) < getTimestampYMD(_startDate) || getTimestampYMD(time) > getTimestampYMD(_startDate) + DAY_TIMESTAMP;
return getTimestampYMD(time) < getTimestampYMD(date) || getTimestampYMD(time) > getTimestampYMD(date) + DAY_TIMESTAMP;
// return getTimestampYMD(time) !== getTimestampYMD(date)
}
}
},
endTimeOptions() {
const { startDate, endDate, startTime } = this.form
const fullDate = this.getFullDateTime(startDate, startTime)
const minutes = fullDate.getMinutes()
let options
if (this.isSameDate(startDate, endDate)) {
const startTime = getCurHalfHour('end', fullDate)
// 结束日期和开始日期同一天,会议最低半小时,则向后推半小时
let _startTime
if (startTime === '23:30') _startTime = '24:00'
else {
const _date = fullDate.setMinutes(minutes + 30)
_startTime = dateFormat(_date, '{h}:{i}')
}
options = {
start: startTime,
start: _startTime,
step: '00:30',
end: '23:30'
end: '24:00'
}
} else {
const endTime = getCurHalfHour('start', fullDate)
// 结束时间和开始时间不能超过24小时,相隔一天,则向前推半小时
const _date = fullDate.setMinutes(minutes - 30)
const endTime = dateFormat(_date, '{h}:{i}')
options = {
start: '00:00',
step: '00:30',
......
......@@ -286,7 +286,7 @@ export default {
}
},
endDateShowFormat() {
const date = this.form.startDate
const date = this.form.endDate
if (typeof date === 'object' && date instanceof Date) {
return 'yyyy-MM-dd 周' + dateFormat(date, '{a}')
} else {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论