mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: fix contest_edit timezone convert
This commit is contained in:
1 parent
0c587d1786
commit
c00c2160ec
7 files changed
+22
-23
No files matched your search
+3
-3
@@ -33,7 +33,7 @@
|
||||
"@types/autocannon": "^7.9.0",
|
||||
"@types/cross-spawn": "^6.0.2",
|
||||
"@types/mocha": "^10.0.0",
|
||||
"@types/node": "^18.11.2",
|
||||
"@types/node": "^18.11.3",
|
||||
"@types/semver": "^7.3.12",
|
||||
"@types/supertest": "^2.0.12",
|
||||
"@typescript-eslint/eslint-plugin": "^5.40.1",
|
||||
@@ -43,10 +43,10 @@
|
||||
"cross-env": "^7.0.3",
|
||||
"cross-spawn": "^7.0.3",
|
||||
"esbuild": "0.15.2",
|
||||
"eslint": "^8.25.0",
|
||||
"eslint": "^8.26.0",
|
||||
"eslint-config-airbnb": "^19.0.4",
|
||||
"eslint-config-airbnb-typescript": "^17.0.0",
|
||||
"eslint-import-resolver-typescript": "^3.5.1",
|
||||
"eslint-import-resolver-typescript": "^3.5.2",
|
||||
"eslint-import-resolver-webpack": "^0.13.2",
|
||||
"eslint-plugin-import": "2.26.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.6.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "4.2.8",
|
||||
"version": "4.2.9",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/plugin-api",
|
||||
"module": "src/plugin-api",
|
||||
@@ -12,11 +12,11 @@
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-s3": "^3.186.0",
|
||||
"@aws-sdk/lib-storage": "^3.186.0",
|
||||
"@aws-sdk/middleware-endpoint": "^3.186.0",
|
||||
"@aws-sdk/s3-presigned-post": "^3.186.0",
|
||||
"@aws-sdk/s3-request-presigner": "^3.186.0",
|
||||
"@aws-sdk/client-s3": "^3.194.0",
|
||||
"@aws-sdk/lib-storage": "^3.194.0",
|
||||
"@aws-sdk/middleware-endpoint": "^3.193.0",
|
||||
"@aws-sdk/s3-presigned-post": "^3.194.0",
|
||||
"@aws-sdk/s3-request-presigner": "^3.194.0",
|
||||
"@graphql-tools/schema": "^8.5.1",
|
||||
"@hydrooj/utils": "workspace:*",
|
||||
"adm-zip": "0.5.5",
|
||||
@@ -39,7 +39,7 @@
|
||||
"lodash": "^4.17.21",
|
||||
"lru-cache": "7.12.0",
|
||||
"mime-types": "^2.1.35",
|
||||
"moment-timezone": "^0.5.37",
|
||||
"moment-timezone": "^0.5.38",
|
||||
"mongodb": "^3.7.3",
|
||||
"nanoid": "^4.0.0",
|
||||
"nodemailer": "^6.8.0",
|
||||
|
||||
@@ -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',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.42.7",
|
||||
"version": "4.42.8",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "index.ts",
|
||||
@@ -36,7 +36,7 @@
|
||||
"@types/webpack-env": "^1.18.0",
|
||||
"@vscode/codicons": "^0.0.32",
|
||||
"autoprefixer": "^10.4.12",
|
||||
"browser-update": "^3.3.40",
|
||||
"browser-update": "^3.3.44",
|
||||
"chalk": "^5.1.2",
|
||||
"classnames": "^2.3.2",
|
||||
"clean-webpack-plugin": "^4.0.0",
|
||||
@@ -121,7 +121,7 @@
|
||||
"fs-extra": "^10.1.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"jsesc": "^3.0.2",
|
||||
"katex": "^0.16.2",
|
||||
"katex": "^0.16.3",
|
||||
"lodash": "^4.17.21",
|
||||
"markdown-it": "^13.0.1",
|
||||
"markdown-it-anchor": "^8.6.5",
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
label:'Begin Date',
|
||||
name:'beginAtDate',
|
||||
placeholder:'YYYY-mm-dd',
|
||||
value:beginAt.format('%Y-%m-%d'),
|
||||
value:beginAt.format('YYYY-M-D'),
|
||||
date:true,
|
||||
row:false
|
||||
}) }}
|
||||
@@ -55,7 +55,7 @@
|
||||
label:'Begin Time',
|
||||
name:'beginAtTime',
|
||||
placeholder:'HH:MM',
|
||||
value:beginAt.format('%H:%M'),
|
||||
value:beginAt.format('H:mm'),
|
||||
time:true,
|
||||
row:false
|
||||
}) }}
|
||||
|
||||
@@ -10,9 +10,6 @@ declare global {
|
||||
interface ArrayConstructor {
|
||||
isDiff: (a: any[], b: any[]) => boolean;
|
||||
}
|
||||
interface Date {
|
||||
format: (fmt?: string) => string;
|
||||
}
|
||||
interface Math {
|
||||
sum: (...args: Array<number[] | number>) => number;
|
||||
}
|
||||
@@ -75,6 +72,7 @@ Array.isDiff = function isDiff(a, b) {
|
||||
return false;
|
||||
};
|
||||
|
||||
// @ts-ignore
|
||||
Date.prototype.format = function formatDate(fmt = '%Y-%m-%d %H:%M:%S') {
|
||||
let m = this.getMonth() + 1;
|
||||
if (m < 10) m = `0${m}`;
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
"esbuild": "0.15.2",
|
||||
"fs-extra": "^10.1.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"moment-timezone": "^0.5.37",
|
||||
"moment-timezone": "^0.5.38",
|
||||
"mongodb": "^3.7.3",
|
||||
"reggol": "^1.3.0",
|
||||
"reggol": "^1.3.1",
|
||||
"source-map-support": "^0.5.21",
|
||||
"systeminformation": "^5.12.6"
|
||||
"systeminformation": "^5.12.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/fs-extra": "^9.0.13",
|
||||
|
||||
Reference in new issue
Block a user