fix today being berlin timezone
This commit is contained in:
@@ -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