@explorer-1/vue 0.2.81 → 0.2.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/utils/mixins.ts +23 -10
package/package.json
CHANGED
package/src/utils/mixins.ts
CHANGED
|
@@ -293,20 +293,33 @@ export const mixinFormatSplitEventDates = (
|
|
|
293
293
|
endDatetime?: string,
|
|
294
294
|
compact?: boolean
|
|
295
295
|
): EventDateObject => {
|
|
296
|
-
const
|
|
296
|
+
const endDateDayjs = endDatetime ? dayjs(endDatetime) : undefined
|
|
297
297
|
|
|
298
|
-
const
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
298
|
+
const startDateDayjs = () => {
|
|
299
|
+
// use the end date if the event has started but hasn't ended
|
|
300
|
+
let date = startDatetime
|
|
301
|
+
const startDate = startDatetime ? dayjs(startDatetime) : undefined
|
|
302
|
+
if (startDatetime && endDatetime && endDateDayjs && startDate) {
|
|
303
|
+
let now = dayjs(new Date())
|
|
304
|
+
if (endDateDayjs > now && startDate < now) {
|
|
305
|
+
date = endDatetime
|
|
306
|
+
} else {
|
|
307
|
+
date = startDatetime
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
return dayjs(date)
|
|
311
|
+
}
|
|
303
312
|
|
|
304
|
-
|
|
305
|
-
|
|
313
|
+
const monthFormat = compact ? 'MM' : 'MMM'
|
|
314
|
+
let day = startDateDayjs().format('D')
|
|
315
|
+
const month = startDateDayjs().format(monthFormat).replace('.', '')
|
|
316
|
+
const year = startDateDayjs().format('YYYY')
|
|
317
|
+
const monthAndYear = startDateDayjs().format(`${monthFormat} YYYY`)
|
|
306
318
|
|
|
319
|
+
if (endDateDayjs) {
|
|
307
320
|
if (
|
|
308
|
-
startDateDayjs.format('MM') === endDateDayjs.format('MM') &&
|
|
309
|
-
startDateDayjs.format('ll') !== endDateDayjs.format('ll')
|
|
321
|
+
startDateDayjs().format('MM') === endDateDayjs.format('MM') &&
|
|
322
|
+
startDateDayjs().format('ll') !== endDateDayjs.format('ll')
|
|
310
323
|
) {
|
|
311
324
|
// If event spans multiple days within the same month, show both days
|
|
312
325
|
day = `${day}-${endDateDayjs.format('D')}`
|