mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 21:19:01 +01:00 
			
		
		
		
	feat(calendar_view): render notes by their end date
This commit is contained in:
		
							parent
							
								
									64b446315d
								
							
						
					
					
						commit
						8111352300
					
				@ -58,15 +58,23 @@ export default class CalendarView extends ViewMode {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        for (const note of notes) {
 | 
					        for (const note of notes) {
 | 
				
			||||||
            const startDate = note.getAttributeValue("label", "startDate");
 | 
					            const startDate = note.getAttributeValue("label", "startDate");
 | 
				
			||||||
 | 
					 | 
				
			||||||
            if (!startDate) {
 | 
					            if (!startDate) {
 | 
				
			||||||
                continue;
 | 
					                continue;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            events.push({
 | 
					            const eventData: typeof events[0] = {
 | 
				
			||||||
                title: note.title,
 | 
					                title: note.title,
 | 
				
			||||||
                start: startDate
 | 
					                start: startDate
 | 
				
			||||||
            });
 | 
					            };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            const endDate = new Date(note.getAttributeValue("label", "endDate") ?? startDate);
 | 
				
			||||||
 | 
					            if (endDate) {
 | 
				
			||||||
 | 
					                // Fullcalendar end date is exclusive, not inclusive.
 | 
				
			||||||
 | 
					                endDate.setDate(endDate.getDate() + 1);
 | 
				
			||||||
 | 
					                eventData.end = endDate.toISOString().substring(0, 10);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            events.push(eventData);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return events;
 | 
					        return events;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user