diff options
author | Stefan Giehl <stefan@matomo.org> | 2022-07-11 13:13:22 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-11 13:13:22 +0300 |
commit | 87e5fb10874b813ec42f43350fd28d99f8f1aded (patch) | |
tree | b096493b841662fd4890c7e31c2abde9dbef09b2 /plugins/CoreHome/javascripts | |
parent | 1b40a1528d0181792377188f996006f5b1c6052a (diff) |
Preserve date range when switching between periods in evolution graphs (#19395)
Diffstat (limited to 'plugins/CoreHome/javascripts')
-rw-r--r-- | plugins/CoreHome/javascripts/dataTable.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/CoreHome/javascripts/dataTable.js b/plugins/CoreHome/javascripts/dataTable.js index 6007af40ec..253a942fc4 100644 --- a/plugins/CoreHome/javascripts/dataTable.js +++ b/plugins/CoreHome/javascripts/dataTable.js @@ -729,7 +729,13 @@ $.extend(DataTable.prototype, UIControl.prototype, { } var piwikPeriods = piwikHelper.getAngularDependency('piwikPeriods'); - var currentPeriod = piwikPeriods.parse(self.param['period'], self.param['date']); + if (self.param['dateUsedInGraph']) { + // this parameter is passed along when switching between periods. So we perfer using + // it, to avoid a change in the end date shown in the graph + var currentPeriod = piwikPeriods.parse('range', self.param['dateUsedInGraph']); + } else { + var currentPeriod = piwikPeriods.parse(self.param['period'], self.param['date']); + } var endDateOfPeriod = currentPeriod.getDateRange()[1]; endDateOfPeriod = piwikPeriods.format(endDateOfPeriod); |