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} />