FIX: use getter and setter for computed properties (#25259)
This commit is contained in:
parent
60a4d09f1a
commit
d0486a72ac
|
@ -13,21 +13,27 @@ export default Mixin.create({
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed("period")
|
@discourseComputed("period")
|
||||||
startDate(period) {
|
startDate: {
|
||||||
const fullDay = moment().locale("en").utc().endOf("day");
|
get(period) {
|
||||||
|
const fullDay = moment().locale("en").utc().endOf("day");
|
||||||
|
|
||||||
switch (period) {
|
switch (period) {
|
||||||
case "yearly":
|
case "yearly":
|
||||||
return fullDay.subtract(1, "year").startOf("day");
|
return fullDay.subtract(1, "year").startOf("day");
|
||||||
case "quarterly":
|
case "quarterly":
|
||||||
return fullDay.subtract(3, "month").startOf("day");
|
return fullDay.subtract(3, "month").startOf("day");
|
||||||
case "weekly":
|
case "weekly":
|
||||||
return fullDay.subtract(6, "days").startOf("day");
|
return fullDay.subtract(6, "days").startOf("day");
|
||||||
case "monthly":
|
case "monthly":
|
||||||
return fullDay.subtract(1, "month").startOf("day");
|
return fullDay.subtract(1, "month").startOf("day");
|
||||||
default:
|
default:
|
||||||
return fullDay.subtract(1, "month").startOf("day");
|
return fullDay.subtract(1, "month").startOf("day");
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
set(period) {
|
||||||
|
return period;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed()
|
@discourseComputed()
|
||||||
|
@ -41,8 +47,14 @@ export default Mixin.create({
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed()
|
@discourseComputed()
|
||||||
endDate() {
|
endDate: {
|
||||||
return moment().locale("en").utc().endOf("day");
|
get() {
|
||||||
|
return moment().locale("en").utc().endOf("day");
|
||||||
|
},
|
||||||
|
|
||||||
|
set(endDate) {
|
||||||
|
return endDate;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed()
|
@discourseComputed()
|
||||||
|
|
Loading…
Reference in New Issue