create: market close includes time

This commit is contained in:
mantikoros 2022-01-30 23:20:27 -06:00
parent ff4bb3330a
commit d49656cb77

View File

@ -8,7 +8,6 @@ import { Spacer } from '../components/layout/spacer'
import { useUser } from '../hooks/use-user'
import { Contract, contractPath } from '../lib/firebase/contracts'
import { createContract } from '../lib/firebase/api-call'
import { Row } from '../components/layout/row'
import { AmountInput } from '../components/amount-input'
import { MINIMUM_ANTE } from '../../common/antes'
import { InfoTooltip } from '../components/info-tooltip'
@ -73,8 +72,8 @@ export function NewContract(props: { question: string; tag?: string }) {
const [anteError, setAnteError] = useState<string | undefined>()
// By default, close the market a week from today
// const weekFromToday = dayjs().add(7, 'day').format('YYYY-MM-DD')
const [closeDate, setCloseDate] = useState<undefined | string>(undefined)
const weekFromToday = dayjs().add(7, 'day').format('YYYY-MM-DDT23:59')
const [closeDate, setCloseDate] = useState<undefined | string>(weekFromToday)
const [isSubmitting, setIsSubmitting] = useState(false)
@ -157,15 +156,15 @@ export function NewContract(props: { question: string; tag?: string }) {
<div className="form-control items-start mb-1">
<label className="label gap-2 mb-1">
<span>Last trading day</span>
<InfoTooltip text="Trading allowed through 11:59 pm local time on this date." />
<span>Market close</span>
<InfoTooltip text="Trading will be halted after this time (local timezone)." />
</label>
<input
type="date"
type="datetime-local"
className="input input-bordered"
onClick={(e) => e.stopPropagation()}
onChange={(e) => setCloseDate(e.target.value || '')}
min={new Date().toISOString().split('T')[0]}
min={Date.now()}
disabled={isSubmitting}
value={closeDate}
/>