rounded seconds and milliseconds of new tournament dates to 0

This commit is contained in:
Kristoffer Longva Eriksen 2022-04-21 11:05:50 +02:00
parent a283ae90b0
commit 6deead1260
1 changed files with 3 additions and 2 deletions

View File

@ -7,6 +7,7 @@ import { Button, TextField, Stack, InputLabel, Select, Container, Slider, Paper,
import DateTimePicker from '@mui/lab/DateTimePicker'; import DateTimePicker from '@mui/lab/DateTimePicker';
import AdapterDateFns from '@mui/lab/AdapterDateFns'; import AdapterDateFns from '@mui/lab/AdapterDateFns';
import LocalizationProvider from '@mui/lab/LocalizationProvider'; import LocalizationProvider from '@mui/lab/LocalizationProvider';
import { setDate } from "date-fns";
function postTournament(showError, tournamentName, tournamentDescription, tournamentStartDate, tournamentEndDate, tournamentMaxTeams) { function postTournament(showError, tournamentName, tournamentDescription, tournamentStartDate, tournamentEndDate, tournamentMaxTeams) {
if (!tournamentName || tournamentName === "") { if (!tournamentName || tournamentName === "") {
@ -81,8 +82,8 @@ function TournamentForm(props) {
function submitTournament(event) { function submitTournament(event) {
event.preventDefault(); event.preventDefault();
let maxTeams = Math.pow(2, maxTeamsExponent); let maxTeams = Math.pow(2, maxTeamsExponent);
let tournamentStart = new Date(startTime).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).valueOf() - new Date().getTimezoneOffset() * 60000; let tournamentEnd = new Date(endTime.setSeconds(0, 0, 0)).valueOf() - new Date().getTimezoneOffset() * 60*1000;
postTournament( postTournament(
props.showError, props.showError,
document.getElementById("nameInput").value, document.getElementById("nameInput").value,