= {
closeTime: newCloseTime,
}
if (autoResolutionTime) {
const newAutoResolutionTime = newCloseTime + 7 * DAY_MS
if (newAutoResolutionTime >= autoResolutionTime) {
update.autoResolutionTime = newAutoResolutionTime
const formattedNewAutoResolutionTime = dayjs(
newAutoResolutionTime
).format('YYYY-MM-DD h:mm a')
newDescription = newDescription.concat(
`\nAuto resolution date updated to ${formattedNewAutoResolutionTime}`
)
}
}
update.description = newDescription
updateContract(contract.id, update)
setIsEditingCloseTime(false)
}
}
return (
<>
{isEditingCloseTime ? (
e.stopPropagation()}
onChange={(e) => setCloseDate(e.target.value || '')}
min={Date.now()}
value={closeDate}
/>
) : (
Date.now() ? 'Trading ends:' : 'Trading ended:'}
time={closeTime}
>
{isSameYear
? dayjs(closeTime).format('MMM D')
: dayjs(closeTime).format('MMM D, YYYY')}
{isSameDay && <> ({fromNow(closeTime)})>}
)}
{isCreator &&
(isEditingCloseTime ? (
) : (
))}
>
)
}