diff --git a/src/lib/common.html.ts b/src/lib/common.html.ts
index e6f41460..edce6056 100644
--- a/src/lib/common.html.ts
+++ b/src/lib/common.html.ts
@@ -97,8 +97,14 @@ export function getMultiDayEventParts(config: atomicCardConfig, event: EventClas
if (!config.showMultiDayEventParts == true || event.addDays == false && event.daysLong == undefined) {
return
}
+ if (config.showMultiDayEventParts == true && event.addDays >= 1 && event.daysLong) {
+ return html`(${event.addDays}/${event.daysLong})`
+ }
+ if (config.showMultiDayEventParts == true && event.addDays == false && event.daysLong) {
+ const daysSinceStart = dayjs().diff(event.startDateTime, 'day')
+ return html`(${daysSinceStart}/${event.daysLong})`
+ }
- return html`(${event.addDays + 1}/${event.daysLong})`
}
/**
diff --git a/src/lib/event.class.ts b/src/lib/event.class.ts
index 2bd108d2..37c818b7 100644
--- a/src/lib/event.class.ts
+++ b/src/lib/event.class.ts
@@ -254,14 +254,18 @@ export default class EventClass {
daysLong = fullDays;
}
- for (let i = 0; i < daysLong; i++) {
+ for (let i = 1; i < daysLong; i++) {
// copy event then add the current day/total days to 'new' event
const copiedEvent = JSON.parse(JSON.stringify(newEvent.rawEvent));
+ // count the loops, this shows which day of the event we are on
copiedEvent.addDays = i;
+ // count the total number of days in the event
copiedEvent.daysLong = daysLong;
- copiedEvent._isFirstDay = i === 0;
- copiedEvent._isLastDay = i === (daysLong - 1) && i > 0;
+ // is this the first day of the event?
+ copiedEvent._isFirstDay = i === 1;
+ // is this the last day of the event?
+ copiedEvent._isLastDay = i === (daysLong - 1) && i > 1;
// Create event object for each of the days the multi-event occurs on
const partialEvent: EventClass = new EventClass(copiedEvent, this._globalConfig);
diff --git a/src/lib/event.func.ts b/src/lib/event.func.ts
index fb3e97d2..73a4df47 100644
--- a/src/lib/event.func.ts
+++ b/src/lib/event.func.ts
@@ -360,6 +360,5 @@ export function processEvents(allEvents: any[], config: atomicCardConfig) {
newEvents.length = config.maxEventCount;
}
newEvents = sortEventsByEntity(newEvents, config.entities)
-
return newEvents;
}
diff --git a/src/lib/eventMode.html.ts b/src/lib/eventMode.html.ts
index 240877da..abc591f5 100644
--- a/src/lib/eventMode.html.ts
+++ b/src/lib/eventMode.html.ts
@@ -99,7 +99,7 @@ export function getHoursHTML(config: atomicCardConfig, event: EventClass) {
}
// 5. starts before today, ends today -> 'Until end time'
- else if (event.startDateTime.isBefore(today, 'day') && event.endDateTime.isSame(today, 'day')) {
+ else if (event.startDateTime.isBefore(today, 'day') && event.endDateTime.isSame(today, 'day') || event.isLastDay && event.endDateTime.isSame(today, 'day')) {
return html`${config.untilText} ${event.endDateTime.format('LT')} `;
}
// 6. Does not start before today, ends after start