From fa15dbd3649c9b8231f321525e0587583c925859 Mon Sep 17 00:00:00 2001 From: Kristoffer Juelsen Date: Wed, 6 Apr 2022 22:44:05 +0200 Subject: [PATCH] added new date inputs, not fully functional --- src/client/src/TournamentCreator.js | 35 +++++++++++++-------- src/client/src/TournamentManager.js | 48 ++++++++++++++++++++++++++--- 2 files changed, 67 insertions(+), 16 deletions(-) diff --git a/src/client/src/TournamentCreator.js b/src/client/src/TournamentCreator.js index ea082a0..4acc3b5 100644 --- a/src/client/src/TournamentCreator.js +++ b/src/client/src/TournamentCreator.js @@ -4,7 +4,6 @@ import AppBar from "./components/AsuraBar"; import ErrorSnackbar from "./components/ErrorSnackbar"; import { Button, TextField, Stack, InputLabel, Select, Container, Slider, Paper, Box, Grid, Typography } from '@mui/material'; -import FileUploadIcon from '@mui/icons-material/FileUpload'; import DateTimePicker from '@mui/lab/DateTimePicker'; import AdapterDateFns from '@mui/lab/AdapterDateFns'; import LocalizationProvider from '@mui/lab/LocalizationProvider'; @@ -90,6 +89,7 @@ function TournamentForm(props) { endTime, maxTeams ); + console.log(startTime, endTime); } const marks = [ @@ -101,7 +101,8 @@ function TournamentForm(props) { { value: 7, label: "128",} ]; - const [value, setValue] = React.useState([null, null]); + const [startValue, setStartValue] = React.useState(new Date()); + const [endValue, setEndValue] = React.useState(new Date()); return ( <> @@ -114,24 +115,34 @@ function TournamentForm(props) { { - setValue(newValue); + setStartValue(newValue); + console.log(new Date(newValue).toUTCString()); }} - renderInput={(params) => } + renderInput={(params) => } /> { - setValue(newValue); + setEndValue(newValue); + console.log(new Date(newValue).toUTCString()); }} - renderInput={(params) => } + renderInput={(params) => } /> {/* diff --git a/src/client/src/TournamentManager.js b/src/client/src/TournamentManager.js index 33e512f..a249ce5 100644 --- a/src/client/src/TournamentManager.js +++ b/src/client/src/TournamentManager.js @@ -6,9 +6,11 @@ import TournamentBar from "./components/TournamentBar"; import { useParams } from "react-router-dom"; import { Button, TextField, Grid, Box, Container, Paper, Stack } from "@mui/material"; import { Snackbar, IconButton, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from "@mui/material"; -import FileUploadIcon from '@mui/icons-material/FileUpload'; import CloseIcon from '@mui/icons-material/Close'; import DeleteIcon from '@mui/icons-material/Delete'; +import DateTimePicker from '@mui/lab/DateTimePicker'; +import AdapterDateFns from '@mui/lab/AdapterDateFns'; +import LocalizationProvider from '@mui/lab/LocalizationProvider'; let submitChanges = curryTournamentId => event => { event.preventDefault(); @@ -113,9 +115,14 @@ function ManageTournament(props) { document.getElementById("editDesc").value = data.data.description; document.getElementById("editStartDate").value = data.data.startTime.slice(0, 16); document.getElementById("editEndDate").value = data.data.endTime.slice(0, 16); + console.log(data.data.endTime); + console.log(data.data.endTime.slice(0, 16)); }) .catch((err) => showError(err)); }, []); + + const [startValue, setStartValue] = React.useState(); + const [endValue, setEndValue] = React.useState(); return ( <> @@ -123,9 +130,42 @@ function ManageTournament(props) { - - - + + + { + setStartValue(newValue); + console.log(new Date(newValue).toUTCString()); + }} + renderInput={(params) => } + /> + + + { + setEndValue(newValue); + console.log(new Date(newValue).toUTCString()); + }} + renderInput={(params) => } + /> + + + {/* + */}