From 6deead1260f60d49997864b1ea84be860299110d Mon Sep 17 00:00:00 2001 From: Kristoffer Longva Eriksen Date: Thu, 21 Apr 2022 11:05:50 +0200 Subject: [PATCH] rounded seconds and milliseconds of new tournament dates to 0 --- src/client/src/TournamentCreator.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/client/src/TournamentCreator.js b/src/client/src/TournamentCreator.js index 00a6a8b..a589981 100644 --- a/src/client/src/TournamentCreator.js +++ b/src/client/src/TournamentCreator.js @@ -7,6 +7,7 @@ import { Button, TextField, Stack, InputLabel, Select, Container, Slider, Paper, import DateTimePicker from '@mui/lab/DateTimePicker'; import AdapterDateFns from '@mui/lab/AdapterDateFns'; import LocalizationProvider from '@mui/lab/LocalizationProvider'; +import { setDate } from "date-fns"; function postTournament(showError, tournamentName, tournamentDescription, tournamentStartDate, tournamentEndDate, tournamentMaxTeams) { if (!tournamentName || tournamentName === "") { @@ -81,8 +82,8 @@ function TournamentForm(props) { function submitTournament(event) { event.preventDefault(); let maxTeams = Math.pow(2, maxTeamsExponent); - let tournamentStart = new Date(startTime).valueOf() - new Date().getTimezoneOffset() * 60000; - let tournamentEnd = new Date(endTime).valueOf() - new Date().getTimezoneOffset() * 60000; + let tournamentStart = new Date(startTime.setSeconds(0, 0, 0)).valueOf() - new Date().getTimezoneOffset() * 60*1000; + let tournamentEnd = new Date(endTime.setSeconds(0, 0, 0)).valueOf() - new Date().getTimezoneOffset() * 60*1000; postTournament( props.showError, document.getElementById("nameInput").value,