mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Merge pull request #2737 from rejas/RelativeFullDayEvents
Resubmit of "Relative full day events"
This commit is contained in:
commit
c3e507234d
@ -39,6 +39,7 @@ _This release is scheduled to be released on 2022-01-01._
|
|||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fixed error when accessing letsencrypt certificates
|
- Fixed error when accessing letsencrypt certificates
|
||||||
|
- Fixed Calendar module enhancement: displaying full events without time (#2424)
|
||||||
|
|
||||||
## [2.17.0] - 2021-10-01
|
## [2.17.0] - 2021-10-01
|
||||||
|
|
||||||
|
@ -368,9 +368,9 @@ Module.register("calendar", {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Show relative times
|
// Show relative times
|
||||||
if (event.startDate >= now) {
|
if (event.startDate >= now || (event.fullDayEvent && event.today)) {
|
||||||
// Use relative time
|
// Use relative time
|
||||||
if (!this.config.hideTime) {
|
if (!this.config.hideTime && !event.fullDayEvent) {
|
||||||
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").calendar(null, { sameElse: this.config.dateFormat }));
|
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").calendar(null, { sameElse: this.config.dateFormat }));
|
||||||
} else {
|
} else {
|
||||||
timeWrapper.innerHTML = this.capFirst(
|
timeWrapper.innerHTML = this.capFirst(
|
||||||
@ -378,11 +378,22 @@ Module.register("calendar", {
|
|||||||
sameDay: "[" + this.translate("TODAY") + "]",
|
sameDay: "[" + this.translate("TODAY") + "]",
|
||||||
nextDay: "[" + this.translate("TOMORROW") + "]",
|
nextDay: "[" + this.translate("TOMORROW") + "]",
|
||||||
nextWeek: "dddd",
|
nextWeek: "dddd",
|
||||||
sameElse: this.config.dateFormat
|
sameElse: event.fullDayEvent ? this.config.fullDayEventDateFormat : this.config.dateFormat
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (event.startDate - now < this.config.getRelative * oneHour) {
|
if (event.fullDayEvent) {
|
||||||
|
// Full days events within the next two days
|
||||||
|
if (event.today) {
|
||||||
|
timeWrapper.innerHTML = this.capFirst(this.translate("TODAY"));
|
||||||
|
} else if (event.startDate - now < oneDay && event.startDate - now > 0) {
|
||||||
|
timeWrapper.innerHTML = this.capFirst(this.translate("TOMORROW"));
|
||||||
|
} else if (event.startDate - now < 2 * oneDay && event.startDate - now > 0) {
|
||||||
|
if (this.translate("DAYAFTERTOMORROW") !== "DAYAFTERTOMORROW") {
|
||||||
|
timeWrapper.innerHTML = this.capFirst(this.translate("DAYAFTERTOMORROW"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (event.startDate - now < this.config.getRelative * oneHour) {
|
||||||
// If event is within getRelative hours, display 'in xxx' time format or moment.fromNow()
|
// If event is within getRelative hours, display 'in xxx' time format or moment.fromNow()
|
||||||
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow());
|
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user