From a9ea335cd191468df47b665bd2bdf03ef95505b5 Mon Sep 17 00:00:00 2001 From: James Grugett Date: Sat, 27 Aug 2022 01:07:39 -0500 Subject: [PATCH] Fix create page serverside vs clientside render discrepancy console error --- common/util/time.ts | 3 ++- web/pages/create.tsx | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/common/util/time.ts b/common/util/time.ts index 914949e4..9afb8db4 100644 --- a/common/util/time.ts +++ b/common/util/time.ts @@ -1,2 +1,3 @@ -export const HOUR_MS = 60 * 60 * 1000 +export const MINUTE_MS = 60 * 1000 +export const HOUR_MS = 60 * MINUTE_MS export const DAY_MS = 24 * HOUR_MS diff --git a/web/pages/create.tsx b/web/pages/create.tsx index 0c142d67..463f0e9f 100644 --- a/web/pages/create.tsx +++ b/web/pages/create.tsx @@ -33,6 +33,7 @@ import { redirectIfLoggedOut } from 'web/lib/firebase/server-auth' import { Title } from 'web/components/title' import { SEO } from 'web/components/SEO' import { MultipleChoiceAnswers } from 'web/components/answers/multiple-choice-answers' +import { MINUTE_MS } from 'common/util/time' export const getServerSideProps = redirectIfLoggedOut('/', async (_, creds) => { return { props: { auth: await getUserAndPrivateUser(creds.user.uid) } } @@ -427,7 +428,7 @@ export function NewContract(props: { className="input input-bordered mt-4" onClick={(e) => e.stopPropagation()} onChange={(e) => setCloseDate(e.target.value)} - min={Date.now()} + min={Math.round(Date.now() / MINUTE_MS) * MINUTE_MS} disabled={isSubmitting} value={closeDate} />