mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: makes dashboard periods use current day and weekly 7 days (#10817)
Prior to this fix, weekly could be 8 days and we could have differences between period chooser text and actual results in the chart. A good followup to this PR would be to add custom date ranges in period-chooser component.
This commit is contained in:
@@ -14,7 +14,7 @@ export default Mixin.create({
|
||||
|
||||
@discourseComputed("period")
|
||||
startDate(period) {
|
||||
let fullDay = moment().locale("en").utc().subtract(1, "day");
|
||||
let fullDay = moment().locale("en").utc().endOf("day");
|
||||
|
||||
switch (period) {
|
||||
case "yearly":
|
||||
@@ -24,7 +24,7 @@ export default Mixin.create({
|
||||
return fullDay.subtract(3, "month").startOf("day");
|
||||
break;
|
||||
case "weekly":
|
||||
return fullDay.subtract(1, "week").startOf("day");
|
||||
return fullDay.subtract(6, "days").startOf("day");
|
||||
break;
|
||||
case "monthly":
|
||||
return fullDay.subtract(1, "month").startOf("day");
|
||||
@@ -46,7 +46,7 @@ export default Mixin.create({
|
||||
|
||||
@discourseComputed()
|
||||
endDate() {
|
||||
return moment().locale("en").utc().subtract(1, "day").endOf("day");
|
||||
return moment().locale("en").utc().endOf("day");
|
||||
},
|
||||
|
||||
@discourseComputed()
|
||||
|
||||
Reference in New Issue
Block a user