From 8ccd9eb0a5af3e3a05cfe4c041e0a6a709d3d1d1 Mon Sep 17 00:00:00 2001 From: Lim Jonguk Date: Fri, 25 Mar 2022 03:50:55 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=A3=BC=EC=A0=95=EC=B0=A8=20=EC=8B=AC?= =?UTF-8?q?=EC=9D=98=EB=8C=80=EC=83=81=20=EC=A0=80=EC=9E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/biz/parking/Regist.jsx | 1 + .../biz/parking/SaveParkingSimsaForm.jsx | 24 ++++++++++--------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/views/biz/parking/Regist.jsx b/src/views/biz/parking/Regist.jsx index 0c51eb6..c6e7132 100644 --- a/src/views/biz/parking/Regist.jsx +++ b/src/views/biz/parking/Regist.jsx @@ -97,6 +97,7 @@ const ParkingRegister = () => { }; alert(JSON.stringify(param)); setOpen(false); + // return false; opstBizService.saveSimsaTargetList(param).then((response) => { console.log(response); diff --git a/src/views/biz/parking/SaveParkingSimsaForm.jsx b/src/views/biz/parking/SaveParkingSimsaForm.jsx index e4675ed..0de9391 100644 --- a/src/views/biz/parking/SaveParkingSimsaForm.jsx +++ b/src/views/biz/parking/SaveParkingSimsaForm.jsx @@ -2,6 +2,7 @@ import { useState } from 'react'; import NumberFormat from 'react-number-format'; import format from 'date-fns/format'; +import getHours from 'date-fns/getHours'; import koLocale from 'date-fns/locale/ko'; import { Checkbox, FormControlLabel, Grid, Typography, TextField, MenuItem, Select, FormControl, InputLabel } from '@mui/material'; @@ -20,15 +21,16 @@ const teams = [ { code: '003', value: '3팀' }, { code: '004', value: '4팀' } ]; +const toDate = new Date(); const SaveParkingSimsaForm = ({ handleModalSave }) => { const [msuTeam, setMsuTeam] = useState(teams[0].code); - const [msSdate, setMsSdate] = useState(new Date()); - const [msStartsi, setMsStartsi] = useState('09'); - const [msEdate, setMsEdate] = useState(new Date()); + const [msSdate, setMsSdate] = useState(format(toDate, 'yyyy-MM-dd')); + const [msStartsi, setMsStartsi] = useState(getHours(toDate)); + const [msEdate, setMsEdate] = useState(format(toDate, 'yyyy-MM-dd')); const [msChasu, setMsChasu] = useState(); - const [msCdate, setMsCdate] = useState(new Date()); - const [msClosesi, setMsClosesi] = useState('09'); + const [msCdate, setMsCdate] = useState(format(toDate, 'yyyy-MM-dd')); + const [msClosesi, setMsClosesi] = useState(getHours(toDate)); const onSave = () => { handleModalSave({ @@ -36,7 +38,7 @@ const SaveParkingSimsaForm = ({ handleModalSave }) => { msSdate, msStartsi, msEdate, - msChasu: 99, + msChasu, msCdate, msClosesi }); @@ -72,7 +74,8 @@ const SaveParkingSimsaForm = ({ handleModalSave }) => { inputFormat="HH" mask="__" onChange={(newValue) => { - setMsStartsi(format(newValue, 'HH')); + // setMsStartsi(format(newValue, 'HH')); + setMsStartsi(getHours(newValue)); }} /> @@ -96,7 +99,7 @@ const SaveParkingSimsaForm = ({ handleModalSave }) => { - setMsuTeam(e.target.value)}> {teams.map((team, idx) => ( {team.value} @@ -108,7 +111,6 @@ const SaveParkingSimsaForm = ({ handleModalSave }) => { { format="######" fullWidth value={msChasu} - // onChange={setMsChasu} + onValueChange={(values) => setMsChasu(values.value)} /> @@ -146,7 +148,7 @@ const SaveParkingSimsaForm = ({ handleModalSave }) => { inputFormat="HH" mask="__" onChange={(newValue) => { - setMsClosesi(format(newValue, 'HH')); + setMsClosesi(getHours(newValue)); }} />