mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 15:25:35 +08:00
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")
|
||||
startDate(period) {
|
||||
const fullDay = moment().locale("en").utc().endOf("day");
|
||||
startDate: {
|
||||
get(period) {
|
||||
const fullDay = moment().locale("en").utc().endOf("day");
|
||||
|
||||
switch (period) {
|
||||
case "yearly":
|
||||
return fullDay.subtract(1, "year").startOf("day");
|
||||
case "quarterly":
|
||||
return fullDay.subtract(3, "month").startOf("day");
|
||||
case "weekly":
|
||||
return fullDay.subtract(6, "days").startOf("day");
|
||||
case "monthly":
|
||||
return fullDay.subtract(1, "month").startOf("day");
|
||||
default:
|
||||
return fullDay.subtract(1, "month").startOf("day");
|
||||
}
|
||||
switch (period) {
|
||||
case "yearly":
|
||||
return fullDay.subtract(1, "year").startOf("day");
|
||||
case "quarterly":
|
||||
return fullDay.subtract(3, "month").startOf("day");
|
||||
case "weekly":
|
||||
return fullDay.subtract(6, "days").startOf("day");
|
||||
case "monthly":
|
||||
return fullDay.subtract(1, "month").startOf("day");
|
||||
default:
|
||||
return fullDay.subtract(1, "month").startOf("day");
|
||||
}
|
||||
},
|
||||
|
||||
set(period) {
|
||||
return period;
|
||||
},
|
||||
},
|
||||
|
||||
@discourseComputed()
|
||||
|
@ -41,8 +47,14 @@ export default Mixin.create({
|
|||
},
|
||||
|
||||
@discourseComputed()
|
||||
endDate() {
|
||||
return moment().locale("en").utc().endOf("day");
|
||||
endDate: {
|
||||
get() {
|
||||
return moment().locale("en").utc().endOf("day");
|
||||
},
|
||||
|
||||
set(endDate) {
|
||||
return endDate;
|
||||
},
|
||||
},
|
||||
|
||||
@discourseComputed()
|
||||
|
|
Loading…
Reference in New Issue
Block a user