fix: use timezone offset for Now page
This commit is contained in:
parent
f1bcb761c0
commit
ab957d6f87
1 changed files with 5 additions and 2 deletions
|
|
@ -163,15 +163,18 @@ export async function getNowEvents() {
|
||||||
}
|
}
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
console.log("Offset:", now.getTimezoneOffset(), now.toISOString());
|
console.log("Offset:", now.getTimezoneOffset(), now.toISOString());
|
||||||
|
const offsetNow = new Date(
|
||||||
|
now.getTime() - now.getTimezoneOffset() * 60 * 1000,
|
||||||
|
);
|
||||||
return db
|
return db
|
||||||
.select()
|
.select()
|
||||||
.from(eventsTable)
|
.from(eventsTable)
|
||||||
.where(
|
.where(
|
||||||
and(
|
and(
|
||||||
gte(eventsTable.startTime, now),
|
gte(eventsTable.startTime, offsetNow),
|
||||||
lte(
|
lte(
|
||||||
eventsTable.startTime,
|
eventsTable.startTime,
|
||||||
new Date(now.getTime() + 2 * 60 * 60 * 1000),
|
new Date(offsetNow.getTime() + 2 * 60 * 60 * 1000),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue