mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Added a new parameter to hide time portion on relative times
Added a new parameter hideTime with default value false. This parameter hides the time portion on relative times.
This commit is contained in:
parent
b5b6df5e48
commit
120f0299b2
@ -36,6 +36,7 @@ Module.register("calendar", {
|
|||||||
fadePoint: 0.25, // Start on 1/4th of the list.
|
fadePoint: 0.25, // Start on 1/4th of the list.
|
||||||
hidePrivate: false,
|
hidePrivate: false,
|
||||||
hideOngoing: false,
|
hideOngoing: false,
|
||||||
|
hideTime: false,
|
||||||
colored: false,
|
colored: false,
|
||||||
coloredSymbolOnly: false,
|
coloredSymbolOnly: false,
|
||||||
customEvents: [], // Array of {keyword: "", symbol: "", color: ""} where Keyword is a regexp and symbol/color are to be applied for matched
|
customEvents: [], // Array of {keyword: "", symbol: "", color: ""} where Keyword is a regexp and symbol/color are to be applied for matched
|
||||||
@ -366,7 +367,17 @@ Module.register("calendar", {
|
|||||||
// Show relative times
|
// Show relative times
|
||||||
if (event.startDate >= now) {
|
if (event.startDate >= now) {
|
||||||
// Use relative time
|
// Use relative time
|
||||||
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").calendar());
|
if (!this.config.hideTime) {
|
||||||
|
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").calendar());
|
||||||
|
} else {
|
||||||
|
timeWrapper.innerHTML = this.capFirst(
|
||||||
|
moment(event.startDate, "x").calendar(null, {
|
||||||
|
sameDay: "[Today]",
|
||||||
|
nextDay: "[Tomorrow]",
|
||||||
|
nextWeek: "dddd"
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
if (event.startDate - now < this.config.getRelative * oneHour) {
|
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