Vansh
3 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
17 additions and
0 deletions
-
apps/api/src/app/portfolio/calculator/portfolio-calculator.ts
|
|
@ -889,6 +889,23 @@ export abstract class PortfolioCalculator { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const startYear = startDate.getFullYear(); |
|
|
|
|
|
const endYear = endDate.getFullYear(); |
|
|
|
|
|
|
|
|
|
|
|
for (let year = startYear; year <= endYear; year++) { |
|
|
|
|
|
const firstDay = new Date(year, 0, 1); // January 1st
|
|
|
|
|
|
const lastDay = new Date(year, 11, 31); // December 31st
|
|
|
|
|
|
|
|
|
|
|
|
// Add only if they lie within the selected range
|
|
|
|
|
|
if (!isBefore(firstDay, startDate) && !isAfter(firstDay, endDate)) { |
|
|
|
|
|
chartDateMap[format(firstDay, DATE_FORMAT)] = true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!isBefore(lastDay, startDate) && !isAfter(lastDay, endDate)) { |
|
|
|
|
|
chartDateMap[format(lastDay, DATE_FORMAT)] = true; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return chartDateMap; |
|
|
return chartDateMap; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|