diff --git a/ghost/admin/app/services/dashboard-stats.js b/ghost/admin/app/services/dashboard-stats.js index 8ffcb7d54b..c55d5f5363 100644 --- a/ghost/admin/app/services/dashboard-stats.js +++ b/ghost/admin/app/services/dashboard-stats.js @@ -242,11 +242,14 @@ export default class DashboardStatsService extends Service { if (!this.memberAttributionStats) { return []; } + + const firstChartDay = moment().add(-this.chartDays, 'days').format('YYYY-MM-DD'); + return this.memberAttributionStats.filter((stat) => { if (this.chartDays === 'all') { return true; } - return stat.date >= moment().add(-this.chartDays, 'days').format('YYYY-MM-DD'); + return stat.date >= firstChartDay; }).reduce((acc, stat) => { const statSource = stat.source ?? ''; const existingSource = acc.find(s => s.source.toLowerCase() === statSource.toLowerCase());