Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
Today KU
Commits
c97d4382
Commit
c97d4382
authored
Oct 31, 2021
by
Kim, Subin
Browse files
DatePicker 수정 완료
parent
50bb1b1b
Changes
2
Hide whitespace changes
Inline
Side-by-side
client/src/components/Calendar/AdminMonthly.js
View file @
c97d4382
...
@@ -103,7 +103,7 @@ const AdminMonthly = () => {
...
@@ -103,7 +103,7 @@ const AdminMonthly = () => {
themeSystem
=
'
bootstrap
'
themeSystem
=
'
bootstrap
'
height
=
'
78vh
'
height
=
'
78vh
'
/>
/>
<
DatePickerModal
initialDate
=
{
initialDate
}
changeDate
=
{
changeDate
}
setChangeDate
=
{
setChangeDate
}
pickerS
how
=
{
pickerShow
}
set
Picker
Show
=
{
setPickerShow
}
/
>
<
DatePickerModal
initialDate
=
{
initialDate
}
changeDate
=
{
changeDate
}
setChangeDate
=
{
setChangeDate
}
s
how
=
{
pickerShow
}
setShow
=
{
setPickerShow
}
/
>
<
ScheduleModal
dateShow
=
{
dateShow
}
setDateShow
=
{
setDateShow
}
/
>
<
ScheduleModal
dateShow
=
{
dateShow
}
setDateShow
=
{
setDateShow
}
/
>
<
/
>
<
/
>
)
)
...
...
client/src/components/Modal/DatePickerModal.js
View file @
c97d4382
import
{
useState
,
useEffect
}
from
"
react
"
;
import
{
useState
,
useEffect
}
from
"
react
"
;
import
moment
from
'
moment
'
;
import
moment
from
'
moment
'
;
const
DatePickerModal
=
({
initialDate
,
changeDate
,
setChangeDate
,
pickerS
how
,
set
Picker
Show
})
=>
{
const
DatePickerModal
=
({
initialDate
,
changeDate
,
setChangeDate
,
s
how
,
setShow
})
=>
{
const
[
date
,
setDate
]
=
useState
({
year
:
moment
(
changeDate
).
get
(
'
year
'
),
month
:
moment
(
changeDate
).
get
(
'
month
'
)
+
1
})
const
[
date
,
setDate
]
=
useState
({
year
:
moment
(
changeDate
).
get
(
'
year
'
),
month
:
moment
(
changeDate
).
get
(
'
month
'
)
+
1
})
const
[
year
,
setYear
]
=
useState
({
start
:
moment
(
initialDate
).
get
(
'
year
'
)
-
3
,
end
:
moment
(
initialDate
).
get
(
'
year
'
)
+
3
})
const
[
year
,
setYear
]
=
useState
({
start
:
moment
(
initialDate
).
get
(
'
year
'
)
-
3
,
end
:
moment
(
initialDate
).
get
(
'
year
'
)
+
3
})
const
month
=
moment
(
initialDate
).
get
(
'
month
'
)
+
1
const
month
=
moment
(
initialDate
).
get
(
'
month
'
)
+
1
...
@@ -32,7 +32,7 @@ const DatePickerModal = ({ initialDate, changeDate, setChangeDate, pickerShow, s
...
@@ -32,7 +32,7 @@ const DatePickerModal = ({ initialDate, changeDate, setChangeDate, pickerShow, s
function
cancel
()
{
function
cancel
()
{
setDate
({
year
:
moment
(
changeDate
).
get
(
'
year
'
),
month
:
moment
(
changeDate
).
get
(
'
month
'
)
+
1
})
setDate
({
year
:
moment
(
changeDate
).
get
(
'
year
'
),
month
:
moment
(
changeDate
).
get
(
'
month
'
)
+
1
})
set
Picker
Show
(
false
)
setShow
(
false
)
}
}
function
handleClick
()
{
function
handleClick
()
{
...
@@ -41,26 +41,26 @@ const DatePickerModal = ({ initialDate, changeDate, setChangeDate, pickerShow, s
...
@@ -41,26 +41,26 @@ const DatePickerModal = ({ initialDate, changeDate, setChangeDate, pickerShow, s
else
{
else
{
let
dateStr
=
date
.
year
+
"
-
"
+
date
.
month
+
"
-01
"
let
dateStr
=
date
.
year
+
"
-
"
+
date
.
month
+
"
-01
"
setChangeDate
(
moment
(
dateStr
).
format
(
"
YYYY-MM-DD
"
))
setChangeDate
(
moment
(
dateStr
).
format
(
"
YYYY-MM-DD
"
))
set
Picker
Show
(
false
)
setShow
(
false
)
}
}
}
else
if
(
date
.
year
===
year
.
end
)
{
}
else
if
(
date
.
year
===
year
.
end
)
{
if
(
month
<
date
.
month
)
alert
(
"
선택하신 날짜는 유효하지 않습니다. 다시 선택해주세요.
"
)
if
(
month
<
date
.
month
)
alert
(
"
선택하신 날짜는 유효하지 않습니다. 다시 선택해주세요.
"
)
else
{
else
{
let
dateStr
=
date
.
year
+
"
-
"
+
date
.
month
+
"
-01
"
let
dateStr
=
date
.
year
+
"
-
"
+
date
.
month
+
"
-01
"
setChangeDate
(
moment
(
dateStr
).
format
(
"
YYYY-MM-DD
"
))
setChangeDate
(
moment
(
dateStr
).
format
(
"
YYYY-MM-DD
"
))
set
Picker
Show
(
false
)
setShow
(
false
)
}
}
}
else
{
}
else
{
let
dateStr
=
date
.
year
+
"
-
"
+
date
.
month
+
"
-01
"
let
dateStr
=
date
.
year
+
"
-
"
+
date
.
month
+
"
-01
"
setChangeDate
(
moment
(
dateStr
).
format
(
"
YYYY-MM-DD
"
))
setChangeDate
(
moment
(
dateStr
).
format
(
"
YYYY-MM-DD
"
))
set
Picker
Show
(
false
)
setShow
(
false
)
}
}
}
}
return
(
return
(
<>
<>
{
pickerS
how
?
<
div
className
=
"
offcanvas-backdrop fade show
"
><
/div> : null
}
{
s
how
?
<
div
className
=
"
offcanvas-backdrop fade show
"
><
/div> : null
}
<
div
className
=
{
"
offcanvas offcanvas-bottom
"
+
(
pickerS
how
?
"
visible show
"
:
"
invisiblel
"
)}
tabIndex
=
"
-1
"
id
=
"
datePicker
"
aria
-
labelledby
=
"
datePicker
"
>
<
div
className
=
{
"
offcanvas offcanvas-bottom
"
+
(
s
how
?
"
visible show
"
:
"
invisiblel
"
)}
tabIndex
=
"
-1
"
id
=
"
datePicker
"
aria
-
labelledby
=
"
datePicker
"
>
<
div
className
=
"
offcanvas-body small py-2
"
>
<
div
className
=
"
offcanvas-body small py-2
"
>
<
div
className
=
"
d-flex my-3
"
>
<
div
className
=
"
d-flex my-3
"
>
<
div
className
=
"
col-6 d-flex flex-column justify-content-between align-items-center fs-4
"
>
<
div
className
=
"
col-6 d-flex flex-column justify-content-between align-items-center fs-4
"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment