core: fix contest_edit timezone convert

This commit is contained in:
undefined committed 2022-10-24 02:57:12 +08:00
1 parent 0c587d1786
commit c00c2160ec
7 files changed
+22 -23

No files matched your search

+3 -2
View File
@@ -293,12 +293,13 @@ export class ContestEditHandler extends Handler {
}
let ts = Date.now();
ts = ts - (ts % (15 * Time.minute)) + 15 * Time.minute;
const beginAt = moment(this.tdoc?.beginAt || new Date(ts)).tz(this.user.timeZone);
this.response.body = {
rules,
tdoc: this.tdoc,
duration: tid ? (this.tdoc.endAt.getTime() - this.tdoc.beginAt.getTime()) / Time.hour : 2,
duration: tid ? -beginAt.diff(this.tdoc.endAt, 'hour', true) : 2,
pids: tid ? this.tdoc.pids.join(',') : '',
beginAt: this.tdoc?.beginAt || new Date(ts),
beginAt,
page_name: tid ? 'contest_edit' : 'contest_create',
};
}