mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-10-02 08:07:40 -05:00
Fix E2E tests failing first hour after UTC midnight
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { startOfToday, subHours } from "date-fns";
|
||||
import type { ActionFunction } from "react-router";
|
||||
import { z } from "zod";
|
||||
import { sql } from "~/db/sql";
|
||||
@@ -67,7 +68,12 @@ const SEED_REFERENCE_TIMESTAMP = 1767440151;
|
||||
// TODO: do this cleaner
|
||||
function adjustSeedDatesToCurrent(variation: SeedVariation) {
|
||||
const halfAnHourFromNow = Math.floor((Date.now() + 1000 * 60 * 30) / 1000);
|
||||
const oneHourAgo = Math.floor((Date.now() - 1000 * 60 * 60) / 1000);
|
||||
// clamped to the start of today so that within the first hour after midnight
|
||||
// the event does not fall onto the previous calendar day (calendar renders today onward)
|
||||
const oneHourAgo = Math.floor(
|
||||
Math.max(subHours(new Date(), 1).getTime(), startOfToday().getTime()) /
|
||||
1000,
|
||||
);
|
||||
const now = Math.floor(Date.now() / 1000);
|
||||
|
||||
const tournamentEventIds = sql
|
||||
|
||||
Reference in New Issue
Block a user