@@ -364,8 +364,9 @@ async function fetchAllPbsTasksForProcessing({ client, config }, nodeName) {
364364 let allBackupTasks = [ ] ;
365365 let deduplicationFactor = null ;
366366
367- // Calculate 30-day cutoff timestamp
368- const thirtyDaysAgo = Math . floor ( ( Date . now ( ) - 30 * 24 * 60 * 60 * 1000 ) / 1000 ) ;
367+ // Calculate cutoff timestamp - default to 365 days for calendar view
368+ const backupHistoryDays = parseInt ( process . env . BACKUP_HISTORY_DAYS || '365' ) ;
369+ const thirtyDaysAgo = Math . floor ( ( Date . now ( ) - backupHistoryDays * 24 * 60 * 60 * 1000 ) / 1000 ) ;
369370
370371 // Track backup runs by date and guest to avoid counting multiple snapshots per day
371372 // Use a more comprehensive key to prevent any duplicates
@@ -390,7 +391,7 @@ async function fetchAllPbsTasksForProcessing({ client, config }, nodeName) {
390391 const groupsResponse = await client . get ( `/admin/datastore/${ datastore . name } /groups` ) ;
391392 const groups = groupsResponse . data ?. data || [ ] ;
392393
393- // For each backup group, get recent snapshots (30 days only)
394+ // For each backup group, get snapshots within history period
394395 for ( const group of groups ) {
395396 try {
396397 const snapshotsResponse = await client . get ( `/admin/datastore/${ datastore . name } /snapshots` , {
@@ -401,7 +402,7 @@ async function fetchAllPbsTasksForProcessing({ client, config }, nodeName) {
401402 } ) ;
402403 const allSnapshots = snapshotsResponse . data ?. data || [ ] ;
403404
404- // Filter snapshots to last 30 days only
405+ // Filter snapshots to configured history period
405406 const recentSnapshots = allSnapshots . filter ( snapshot => {
406407 return snapshot [ 'backup-time' ] >= thirtyDaysAgo ;
407408 } ) ;
@@ -477,7 +478,7 @@ async function fetchAllPbsTasksForProcessing({ client, config }, nodeName) {
477478 } ) ;
478479 const allAdminTasks = response . data ?. data || [ ] ;
479480
480- // Filter admin tasks to last 30 days
481+ // Filter admin tasks to configured history period
481482 const recentAdminTasks = allAdminTasks . filter ( task => task . starttime >= thirtyDaysAgo ) ;
482483
483484 // Separate real backup tasks (for enhancement only) from other admin tasks
@@ -600,10 +601,11 @@ async function fetchPveBackupTasks(apiClient, endpointId, nodeName) {
600601 } ) ;
601602 const tasks = response . data ?. data || [ ] ;
602603
603- // Calculate 30-day cutoff timestamp
604- const thirtyDaysAgo = Math . floor ( ( Date . now ( ) - 30 * 24 * 60 * 60 * 1000 ) / 1000 ) ;
604+ // Calculate cutoff timestamp - default to 365 days for calendar view
605+ const backupHistoryDays = parseInt ( process . env . BACKUP_HISTORY_DAYS || '365' ) ;
606+ const thirtyDaysAgo = Math . floor ( ( Date . now ( ) - backupHistoryDays * 24 * 60 * 60 * 1000 ) / 1000 ) ;
605607
606- // Filter to last 30 days and transform to match PBS backup task format
608+ // Filter to configured history period and transform to match PBS backup task format
607609 return tasks
608610 . filter ( task => task . starttime >= thirtyDaysAgo )
609611 . map ( task => {
0 commit comments