mirror of
				https://github.com/MichMich/MagicMirror.git
				synced 2025-11-03 20:55:29 +00:00 
			
		
		
		
	added support for showing end of events through config parameters showEnd and dateEndFormat
This commit is contained in:
		@@ -25,7 +25,9 @@ Module.register("calendar", {
 | 
			
		||||
		urgency: 7,
 | 
			
		||||
		timeFormat: "relative",
 | 
			
		||||
		dateFormat: "MMM Do",
 | 
			
		||||
		dateEndFormat: "HH:mm",
 | 
			
		||||
		fullDayEventDateFormat: "MMM Do",
 | 
			
		||||
		showEnd: true,
 | 
			
		||||
		getRelative: 6,
 | 
			
		||||
		fadePoint: 0.25, // Start on 1/4th of the list.
 | 
			
		||||
		hidePrivate: false,
 | 
			
		||||
@@ -287,6 +289,10 @@ Module.register("calendar", {
 | 
			
		||||
							timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow());
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
					if(this.config.showEnd){
 | 
			
		||||
						timeWrapper.innerHTML += "-" ;
 | 
			
		||||
						timeWrapper.innerHTML += this.capFirst(moment(event.endDate  , "x").format(this.config.fullDayEventDateFormat));
 | 
			
		||||
					}
 | 
			
		||||
				} else {
 | 
			
		||||
					if (event.startDate >= new Date()) {
 | 
			
		||||
						if (event.startDate - now < 2 * oneDay) {
 | 
			
		||||
@@ -325,6 +331,11 @@ Module.register("calendar", {
 | 
			
		||||
							})
 | 
			
		||||
						);
 | 
			
		||||
					}
 | 
			
		||||
					if (this.config.showEnd) {
 | 
			
		||||
						timeWrapper.innerHTML += "-";
 | 
			
		||||
						timeWrapper.innerHTML += this.capFirst(moment(event.endDate, "x").format(this.config.dateEndFormat));
 | 
			
		||||
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				//timeWrapper.innerHTML += ' - '+ moment(event.startDate,'x').format('lll');
 | 
			
		||||
				//console.log(event);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user