mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	refactor(views/calendar): use specific API for date notes for performance
This commit is contained in:
		| @@ -30,6 +30,27 @@ function parseDate(str: string) { | ||||
|     } | ||||
| } | ||||
|  | ||||
| // Source: https://stackoverflow.com/a/30465299/4898894 | ||||
| function getMonthsInDateRange(startDate: string, endDate: string) { | ||||
|     const start = startDate.split('-'); | ||||
|     const end = endDate.split('-'); | ||||
|     const startYear = parseInt(start[0]); | ||||
|     const endYear = parseInt(end[0]); | ||||
|     const dates = []; | ||||
|  | ||||
|     for (let i = startYear; i <= endYear; i++) { | ||||
|         const endMonth = i != endYear ? 11 : parseInt(end[1]) - 1; | ||||
|         const startMon = i === startYear ? parseInt(start[1])-1 : 0; | ||||
|  | ||||
|         for(let j = startMon; j <= endMonth; j = j > 12 ? j % 12 || 11 : j+1) { | ||||
|             const month = j+1; | ||||
|             const displayMonth = month < 10 ? '0'+month : month; | ||||
|             dates.push([i, displayMonth].join('-')); | ||||
|         } | ||||
|     } | ||||
|     return dates; | ||||
| } | ||||
|  | ||||
| function padNum(num: number) { | ||||
|     return `${num <= 9 ? "0" : ""}${num}`; | ||||
| } | ||||
| @@ -621,6 +642,7 @@ export default { | ||||
|     reloadFrontendApp, | ||||
|     reloadTray, | ||||
|     parseDate, | ||||
|     getMonthsInDateRange, | ||||
|     formatDateISO, | ||||
|     formatDateTime, | ||||
|     formatTimeInterval, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user