fix today being berlin timezone
This commit is contained in:
18
package-lock.json
generated
18
package-lock.json
generated
@@ -17,10 +17,12 @@
|
||||
"fastify": "^5.6.2",
|
||||
"fastify-axios": "^1.3.0",
|
||||
"fastify-type-provider-zod": "^6.1.0",
|
||||
"luxon": "^3.7.2",
|
||||
"swagger-themes": "^1.4.3",
|
||||
"zod": "^4.1.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/luxon": "^3.7.1",
|
||||
"@types/node": "^24.10.1",
|
||||
"@types/ws": "^8.18.1",
|
||||
"tsx": "^4.20.6",
|
||||
@@ -780,6 +782,13 @@
|
||||
"integrity": "sha512-k2ENnmBugE/rzQfEcdWHcCY+/FM3VLzH9cYEsbdsoqrvzAKRhUZeRNhAZvB8OitQJ1TBed3yqWtdjzS6wJKBwg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/luxon": {
|
||||
"version": "3.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-3.7.1.tgz",
|
||||
"integrity": "sha512-H3iskjFIAn5SlJU7OuxUmTEpebK6TKB8rxZShDslBMZJ5u9S//KM1sbdAisiSrqwLQncVjnpi2OK2J51h+4lsg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "24.10.11",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.11.tgz",
|
||||
@@ -1586,6 +1595,15 @@
|
||||
"node": "20 || >=22"
|
||||
}
|
||||
},
|
||||
"node_modules/luxon": {
|
||||
"version": "3.7.2",
|
||||
"resolved": "https://registry.npmjs.org/luxon/-/luxon-3.7.2.tgz",
|
||||
"integrity": "sha512-vtEhXh/gNjI9Yg1u4jX/0YVPMvxzHuGgCm6tC5kZyb08yjGWGnqAjGJvcXbqQR2P3MyMEFnRbpcdFS6PBcLqew==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/math-intrinsics": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
"fastify": "^5.6.2",
|
||||
"fastify-axios": "^1.3.0",
|
||||
"fastify-type-provider-zod": "^6.1.0",
|
||||
"luxon": "^3.7.2",
|
||||
"swagger-themes": "^1.4.3",
|
||||
"zod": "^4.1.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/luxon": "^3.7.1",
|
||||
"@types/node": "^24.10.1",
|
||||
"@types/ws": "^8.18.1",
|
||||
"tsx": "^4.20.6",
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
logWarning,
|
||||
type ServiceResult,
|
||||
} from "@dpu/shared";
|
||||
import { DateTime } from "luxon";
|
||||
import { Config } from "../config.js";
|
||||
import type { GristClient } from "./client.js";
|
||||
|
||||
@@ -35,9 +36,13 @@ export class GristService extends BaseService<GristClient> {
|
||||
}
|
||||
}
|
||||
|
||||
private getTodayAsId(date = new Date()) {
|
||||
const start = new Date(date.getFullYear(), 0, 0);
|
||||
const diff = date.getTime() - start.getTime();
|
||||
private getTodayAsId() {
|
||||
const now = DateTime.now().setZone("Europe/Berlin");
|
||||
const start = DateTime.fromObject(
|
||||
{ year: now.year, month: 0, day: 0, hour: 0, minute: 0 },
|
||||
{ zone: "Europe/Berlin" },
|
||||
);
|
||||
const diff = start.diff(now).toMillis();
|
||||
return Math.floor(diff / 86400000);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user