Fix group by month/year not working for YTD (#1598)

* Set time to 00:00:00 when getting current timestamp

* Update changelog
This commit is contained in:
Yash Solanki 2023-01-14 18:00:51 +05:30 committed by GitHub
parent d147c2313f
commit bb99141e9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 5 deletions

View File

@ -16,6 +16,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improved the logo alignment - Improved the logo alignment
### Fixed
- Fixed the grouping by month / year of the dividend and investment timeline
## 1.226.0 - 2023-01-11 ## 1.226.0 - 2023-01-11
### Added ### Added

View File

@ -1468,16 +1468,28 @@ export class PortfolioService {
private getStartDate(aDateRange: DateRange, portfolioStart: Date) { private getStartDate(aDateRange: DateRange, portfolioStart: Date) {
switch (aDateRange) { switch (aDateRange) {
case '1d': case '1d':
portfolioStart = max([portfolioStart, subDays(new Date(), 1)]); portfolioStart = max([
portfolioStart,
subDays(new Date().setHours(0, 0, 0, 0), 1)
]);
break; break;
case 'ytd': case 'ytd':
portfolioStart = max([portfolioStart, setDayOfYear(new Date(), 1)]); portfolioStart = max([
portfolioStart,
setDayOfYear(new Date().setHours(0, 0, 0, 0), 1)
]);
break; break;
case '1y': case '1y':
portfolioStart = max([portfolioStart, subYears(new Date(), 1)]); portfolioStart = max([
portfolioStart,
subYears(new Date().setHours(0, 0, 0, 0), 1)
]);
break; break;
case '5y': case '5y':
portfolioStart = max([portfolioStart, subYears(new Date(), 5)]); portfolioStart = max([
portfolioStart,
subYears(new Date().setHours(0, 0, 0, 0), 5)
]);
break; break;
} }
return portfolioStart; return portfolioStart;

View File

@ -196,7 +196,10 @@ export class InvestmentChartComponent implements OnChanges, OnDestroy {
this.getTooltipPluginConfiguration() this.getTooltipPluginConfiguration()
); );
this.chart.options.scales.x.min = this.daysInMarket this.chart.options.scales.x.min = this.daysInMarket
? subDays(new Date(), this.daysInMarket).toISOString() ? subDays(
new Date().setHours(0, 0, 0, 0),
this.daysInMarket
).toISOString()
: undefined; : undefined;
if ( if (