|
|
@@ -1,7 +1,5 @@
|
|
|
import { EventFrequency } from '@/constant'
|
|
|
|
|
|
-export const ONE_DAY = 86400000
|
|
|
-
|
|
|
export function isMoreThanOneWeek (timestamp) {
|
|
|
return timestamp >= 604800000
|
|
|
}
|
|
|
@@ -261,18 +259,22 @@ export function correctEndTime (endTime) {
|
|
|
}
|
|
|
|
|
|
export function getEventDateDescription (event) {
|
|
|
- const { freq, start, until, startTime } = event
|
|
|
+ const { freq, start, until, endTime } = event
|
|
|
if (freq === EventFrequency.WEEKLY) {
|
|
|
- return until ? `${toDateStr(start)} - ${toDateStr(until, startTime === '00:00:00' ? -1 : 0)}` : `自${toDateStr(start)}开始`
|
|
|
+ return until ? `${toDateStr(start)} - ${toDateStr(until, endTime === '00:00:00' ? -1 : 0)}` : `自${toDateStr(start)}开始`
|
|
|
}
|
|
|
return until ? `${start} - ${until}` : `自${start}开始`
|
|
|
}
|
|
|
|
|
|
+const weekEnum = ['日', '一', '二', '三', '四', '五', '六']
|
|
|
export function getEventExtraDescription (event) {
|
|
|
const { freq, start, until, byDay, startTime, endTime, target } = event
|
|
|
switch (freq) {
|
|
|
case EventFrequency.WEEKLY:
|
|
|
- return `每周${byDay.split(',').sort().map(val => ['日', '一', '二', '三', '四', '五', '六'][val])
|
|
|
+ if (byDay.split(',').length === 7) {
|
|
|
+ return `每天 ${startTime} - ${correctEndTime(endTime)}`
|
|
|
+ }
|
|
|
+ return `每周${byDay.split(',').sort().map(val => weekEnum[val])
|
|
|
.join('、')} ${startTime} - ${correctEndTime(endTime)}`
|
|
|
default:
|
|
|
return target?.duration
|