From 7ff1cf0b9233ef20554a09f2233d135dcc0affd4 Mon Sep 17 00:00:00 2001 From: Milli Date: Sat, 4 Jun 2022 21:16:53 +0200 Subject: [PATCH] fix date, setDate mutates object --- functions/src/create-contract.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions/src/create-contract.ts b/functions/src/create-contract.ts index 9ff2dfd3..d0d90164 100644 --- a/functions/src/create-contract.ts +++ b/functions/src/create-contract.ts @@ -27,6 +27,7 @@ import { import { getNoneAnswer } from '../../common/answer' import { getNewContract } from '../../common/new-contract' import { NUMERIC_BUCKET_COUNT } from '../../common/numeric-constants' +import { DAY_MS } from 'common/util/time' const bodySchema = z.object({ question: z.string().min(1).max(MAX_QUESTION_LENGTH), @@ -64,7 +65,7 @@ export const createContract = newEndpoint(['POST'], async (req, [user, _]) => { } const autoResolution = 'MKT' - const autoResolutionTime = closeTime.setDate(closeTime.getDate() + 7) + const autoResolutionTime = closeTime.getTime() + 7 * DAY_MS // Uses utc time on server: const today = new Date()