FIX: use getter and setter for computed properties (#25259)

This commit is contained in:
Arpit Jalan 2024-01-15 15:04:28 +05:30 committed by GitHub
parent 60a4d09f1a
commit d0486a72ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 28 additions and 16 deletions

View File

@ -13,7 +13,8 @@ export default Mixin.create({
}, },
@discourseComputed("period") @discourseComputed("period")
startDate(period) { startDate: {
get(period) {
const fullDay = moment().locale("en").utc().endOf("day"); const fullDay = moment().locale("en").utc().endOf("day");
switch (period) { switch (period) {
@ -30,6 +31,11 @@ export default Mixin.create({
} }
}, },
set(period) {
return period;
},
},
@discourseComputed() @discourseComputed()
lastWeek() { lastWeek() {
return moment().locale("en").utc().endOf("day").subtract(1, "week"); return moment().locale("en").utc().endOf("day").subtract(1, "week");
@ -41,10 +47,16 @@ export default Mixin.create({
}, },
@discourseComputed() @discourseComputed()
endDate() { endDate: {
get() {
return moment().locale("en").utc().endOf("day"); return moment().locale("en").utc().endOf("day");
}, },
set(endDate) {
return endDate;
},
},
@discourseComputed() @discourseComputed()
today() { today() {
return moment().locale("en").utc().endOf("day"); return moment().locale("en").utc().endOf("day");