Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WhenMeet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
During summer vacation, Gitlab will be restart frequently. Use it carefully.
Show more breadcrumbs
websystem2023-2
WhenMeet
Commits
b6d43bbb
Commit
b6d43bbb
authored
Dec 5, 2023
by
이권민
Browse files
Options
Downloads
Patches
Plain Diff
[EDIT] 달력 로직 수정
parent
b926cf44
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
react-whenMeet/src/components/CalendarMonth.jsx
+355
-225
355 additions, 225 deletions
react-whenMeet/src/components/CalendarMonth.jsx
with
355 additions
and
225 deletions
react-whenMeet/src/components/CalendarMonth.jsx
+
355
−
225
View file @
b6d43bbb
import
React
,
{
useState
}
from
"
react
"
import
React
,
{
useState
}
from
"
react
"
;
import
MakeDay
from
"
./MakeDay
"
;
import
MakeDay
from
"
./MakeDay
"
;
import
MakeHeader
from
"
./MakeHeader
"
;
import
MakeHeader
from
"
./MakeHeader
"
;
import
TableCell
from
"
./TableCell
"
;
import
TableCell
from
"
./TableCell
"
;
function
MakeCell
({
nowYear
,
nowMonth
,
usingDate
,
setUsingDate
,
startDate
,
endDate
,
setStartDate
,
setEndDate
}){
//주차 데이터를 담을 공간
function
MakeCell
({
nowYear
,
nowMonth
,
usingDate
,
setUsingDate
,
startDate
,
endDate
,
setStartDate
,
setEndDate
,
})
{
//주차 데이터를 담을 공간
const
calendarArr
=
[];
const
calendarArr
=
[];
const
startDay
=
new
Date
(
nowYear
,
nowMonth
-
1
,
1
);
const
startDay
=
new
Date
(
nowYear
,
nowMonth
-
1
,
1
);
...
@@ -21,16 +31,17 @@ function MakeCell({ nowYear, nowMonth, usingDate, setUsingDate, startDate, endDa
...
@@ -21,16 +31,17 @@ function MakeCell({ nowYear, nowMonth, usingDate, setUsingDate, startDate, endDa
const
[
finish
,
setFinish
]
=
useState
(
false
);
const
[
finish
,
setFinish
]
=
useState
(
false
);
// 여기 달력 날짜 수정해야함
// 여기 달력 날짜 수정해야함
const
fDay
=
new
Date
(
nowYear
,
nowMonth
-
1
,
1
-
startDay
.
getDay
())
-
(
0
);
const
fDay
=
new
Date
(
nowYear
,
nowMonth
-
1
,
1
-
startDay
.
getDay
())
-
0
;
const
eDay
=
new
Date
(
nowYear
,
nowMonth
-
1
,
lastDate
+
6
-
lastDay
.
getDay
())
-
(
0
);
const
eDay
=
new
Date
(
nowYear
,
nowMonth
-
1
,
lastDate
+
6
-
lastDay
.
getDay
())
-
0
;
const
handleDragStart
=
(
newDate
,
idx
,
comp
)
=>
{
const
handleDragStart
=
(
newDate
,
idx
,
comp
)
=>
{
setIsDragging
(
!
isDragging
);
setIsDragging
(
!
isDragging
);
setDragStartDay
(
newDate
);
setDragStartDay
(
newDate
);
setFinish
(
false
);
setFinish
(
false
);
for
(
let
day
=
fDay
;
day
<=
eDay
;
day
+=
(
60
*
60
*
24
*
1000
)
)
{
for
(
let
day
=
fDay
;
day
<=
eDay
;
day
+=
60
*
60
*
24
*
1000
)
{
const
elm
=
document
.
getElementById
(
day
);
const
elm
=
document
.
getElementById
(
day
);
elm
.
classList
.
remove
(
"
dragging
"
)
elm
.
classList
.
remove
(
"
dragging
"
)
;
}
}
};
};
...
@@ -46,59 +57,112 @@ function MakeCell({ nowYear, nowMonth, usingDate, setUsingDate, startDate, endDa
...
@@ -46,59 +57,112 @@ function MakeCell({ nowYear, nowMonth, usingDate, setUsingDate, startDate, endDa
sd
=
ed
;
sd
=
ed
;
ed
=
tmp
;
ed
=
tmp
;
}
}
for
(
let
day
=
fDay
;
day
<=
eDay
;
day
+=
(
60
*
60
*
24
*
1000
)
)
{
for
(
let
day
=
fDay
;
day
<=
eDay
;
day
+=
60
*
60
*
24
*
1000
)
{
const
elm
=
document
.
getElementById
(
day
);
const
elm
=
document
.
getElementById
(
day
);
elm
.
classList
.
remove
(
"
dragging
"
)
elm
.
classList
.
remove
(
"
dragging
"
)
;
}
}
const
elm2
=
document
.
getElementById
(
comp
);
const
elm2
=
document
.
getElementById
(
comp
);
// console.log(comp);
// console.log(comp);
if
(
elm2
.
classList
.
contains
(
"
dragging
"
))
{
if
(
elm2
.
classList
.
contains
(
"
dragging
"
))
{
for
(
let
day
=
ed
;
day
>=
comp
;
day
-=
(
60
*
60
*
24
*
1000
)
)
{
for
(
let
day
=
ed
;
day
>=
comp
;
day
-=
60
*
60
*
24
*
1000
)
{
const
elm
=
document
.
getElementById
(
day
);
const
elm
=
document
.
getElementById
(
day
);
elm
.
classList
.
remove
(
"
dragging
"
)
elm
.
classList
.
remove
(
"
dragging
"
)
;
}
}
}
}
else
{
else
{
for
(
let
day
=
sd
;
day
<=
ed
;
day
+=
60
*
60
*
24
*
1000
)
{
for
(
let
day
=
sd
;
day
<=
ed
;
day
+=
(
60
*
60
*
24
*
1000
)){
const
elm
=
document
.
getElementById
(
day
);
const
elm
=
document
.
getElementById
(
day
);
elm
.
classList
.
add
(
"
dragging
"
)
elm
.
classList
.
add
(
"
dragging
"
)
;
}
}
}
}
};
};
// let startDate="";
// let startDate="";
// let endDate="";
// let endDate="";
const
handleDragEnd
=
(
newDate
,
idx
)
=>
{
const
handleDragEnd
=
(
newDate
,
idx
)
=>
{
setIsDragging
(
false
);
setIsDragging
(
false
);
// setDragging("nope");
// setDragging("nope");
if
(
dragStartDay
-
0
<
dragEndDay
-
0
)
{
if
(
dragStartDay
-
0
<
dragEndDay
-
0
)
{
// startDate = dragStartDay.getFullYear() + '-' + (dragStartDay.getMonth()+1) + '-' + dragStartDay.getDate();
// startDate = dragStartDay.getFullYear() + '-' + (dragStartDay.getMonth()+1) + '-' + dragStartDay.getDate();
// endDate = dragEndDay.getFullYear() + '-' + (dragEndDay.getMonth()+1) + '-' + dragEndDay.getDate();
// endDate = dragEndDay.getFullYear() + '-' + (dragEndDay.getMonth()+1) + '-' + dragEndDay.getDate();
setStartDate
(
dragStartDay
.
getFullYear
()
+
'
-
'
+
String
(
dragStartDay
.
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
'
-
'
+
String
(
dragStartDay
.
getDate
()).
padStart
(
2
,
"
0
"
))
setStartDate
(
setEndDate
(
dragEndDay
.
getFullYear
()
+
'
-
'
+
String
(
dragEndDay
.
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
'
-
'
+
String
(
dragEndDay
.
getDate
()).
padStart
(
2
,
"
0
"
))
dragStartDay
.
getFullYear
()
+
}
"
-
"
+
else
{
String
(
dragStartDay
.
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
"
-
"
+
String
(
dragStartDay
.
getDate
()).
padStart
(
2
,
"
0
"
)
);
setEndDate
(
dragEndDay
.
getFullYear
()
+
"
-
"
+
String
(
dragEndDay
.
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
"
-
"
+
String
(
dragEndDay
.
getDate
()).
padStart
(
2
,
"
0
"
)
);
setUsingDate
({
startDate
:
dragStartDay
.
getFullYear
()
+
"
-
"
+
String
(
dragStartDay
.
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
"
-
"
+
String
(
dragStartDay
.
getDate
()).
padStart
(
2
,
"
0
"
),
endDate
:
dragEndDay
.
getFullYear
()
+
"
-
"
+
String
(
dragEndDay
.
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
"
-
"
+
String
(
dragEndDay
.
getDate
()).
padStart
(
2
,
"
0
"
),
});
}
else
{
// endDate = dragStartDay.getFullYear() + '-' + (dragStartDay.getMonth()+1) + '-' + dragStartDay.getDate();
// endDate = dragStartDay.getFullYear() + '-' + (dragStartDay.getMonth()+1) + '-' + dragStartDay.getDate();
// startDate = dragEndDay.getFullYear() + '-' + (dragEndDay.getMonth()+1) + '-' + dragEndDay.getDate();
// startDate = dragEndDay.getFullYear() + '-' + (dragEndDay.getMonth()+1) + '-' + dragEndDay.getDate();
setStartDate
(
dragEndDay
.
getFullYear
()
+
'
-
'
+
String
(
dragEndDay
.
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
'
-
'
+
String
(
dragEndDay
.
getDate
()).
padStart
(
2
,
"
0
"
))
setStartDate
(
setEndDate
(
dragStartDay
.
getFullYear
()
+
'
-
'
+
String
(
dragStartDay
.
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
'
-
'
+
String
(
dragStartDay
.
getDate
()).
padStart
(
2
,
"
0
"
))
dragEndDay
.
getFullYear
()
+
"
-
"
+
String
(
dragEndDay
.
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
"
-
"
+
String
(
dragEndDay
.
getDate
()).
padStart
(
2
,
"
0
"
)
);
setEndDate
(
dragStartDay
.
getFullYear
()
+
"
-
"
+
String
(
dragStartDay
.
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
"
-
"
+
String
(
dragStartDay
.
getDate
()).
padStart
(
2
,
"
0
"
)
);
setUsingDate
({
startDate
:
dragEndDay
.
getFullYear
()
+
"
-
"
+
String
(
dragEndDay
.
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
"
-
"
+
String
(
dragEndDay
.
getDate
()).
padStart
(
2
,
"
0
"
),
endDate
:
dragStartDay
.
getFullYear
()
+
"
-
"
+
String
(
dragStartDay
.
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
"
-
"
+
String
(
dragStartDay
.
getDate
()).
padStart
(
2
,
"
0
"
),
});
}
}
// console.log(startDate);
// console.log(startDate);
// console.log(endDate);
// console.log(endDate);
setUsingDate
({
startDate
:
startDate
,
endDate
:
endDate
})
setFinish
(
true
);
setFinish
(
true
);
};
};
const
handleClick
=
(
newDate
,
idx
,
comp
)
=>
{
const
handleClick
=
(
newDate
,
idx
,
comp
)
=>
{
if
(
startDate
&&
!
finish
)
{
if
(
startDate
&&
!
finish
)
{
// endDate = newDate.getFullYear() + '-' + (newDate.getMonth()+1) + '-' + newDate.getDate();
// endDate = newDate.getFullYear() + '-' + (newDate.getMonth()+1) + '-' + newDate.getDate();
setEndDate
(
newDate
.
getFullYear
()
+
'
-
'
+
String
(
newDate
.
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
'
-
'
+
String
(
newDate
.
getDate
()).
padStart
(
2
,
"
0
"
));
setEndDate
(
newDate
.
getFullYear
()
+
"
-
"
+
String
(
newDate
.
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
"
-
"
+
String
(
newDate
.
getDate
()).
padStart
(
2
,
"
0
"
)
);
// console.log("e", endDate);
// console.log("e", endDate);
let
sd
=
new
Date
(
startDate
+
'
T00:00:00
'
)
-
0
;
let
sd
=
new
Date
(
startDate
+
"
T00:00:00
"
)
-
0
;
let
ed
=
new
Date
(
newDate
)
-
0
;
let
ed
=
new
Date
(
newDate
)
-
0
;
// let sd = new Date(startDate) - 0;
// let sd = new Date(startDate) - 0;
// let ed = new Date(newDate) - 0;
// let ed = new Date(newDate) - 0;
...
@@ -108,65 +172,103 @@ function MakeCell({ nowYear, nowMonth, usingDate, setUsingDate, startDate, endDa
...
@@ -108,65 +172,103 @@ function MakeCell({ nowYear, nowMonth, usingDate, setUsingDate, startDate, endDa
sd
=
ed
;
sd
=
ed
;
ed
=
tmp
;
ed
=
tmp
;
}
}
console
.
log
(
new
Date
(
sd
).
getFullYear
()
+
'
-
'
+
String
(
new
Date
(
sd
).
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
'
-
'
+
String
(
new
Date
(
sd
).
getDate
()).
padStart
(
2
,
"
0
"
))
console
.
log
(
console
.
log
(
new
Date
(
ed
).
getFullYear
()
+
'
-
'
+
String
(
new
Date
(
ed
).
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
'
-
'
+
String
(
new
Date
(
ed
).
getDate
()).
padStart
(
2
,
"
0
"
))
new
Date
(
sd
).
getFullYear
()
+
"
-
"
+
String
(
new
Date
(
sd
).
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
"
-
"
+
String
(
new
Date
(
sd
).
getDate
()).
padStart
(
2
,
"
0
"
)
);
console
.
log
(
new
Date
(
ed
).
getFullYear
()
+
"
-
"
+
String
(
new
Date
(
ed
).
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
"
-
"
+
String
(
new
Date
(
ed
).
getDate
()).
padStart
(
2
,
"
0
"
)
);
setStartDate
(
new
Date
(
sd
).
getFullYear
()
+
'
-
'
+
String
(
new
Date
(
sd
).
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
'
-
'
+
String
(
new
Date
(
sd
).
getDate
()).
padStart
(
2
,
"
0
"
))
setStartDate
(
setEndDate
(
new
Date
(
ed
).
getFullYear
()
+
'
-
'
+
String
(
new
Date
(
ed
).
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
'
-
'
+
String
(
new
Date
(
ed
).
getDate
()).
padStart
(
2
,
"
0
"
))
new
Date
(
sd
).
getFullYear
()
+
"
-
"
+
String
(
new
Date
(
sd
).
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
"
-
"
+
String
(
new
Date
(
sd
).
getDate
()).
padStart
(
2
,
"
0
"
)
);
setEndDate
(
new
Date
(
ed
).
getFullYear
()
+
"
-
"
+
String
(
new
Date
(
ed
).
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
"
-
"
+
String
(
new
Date
(
ed
).
getDate
()).
padStart
(
2
,
"
0
"
)
);
if
(
sd
<
fDay
)
sd
=
fDay
;
if
(
sd
<
fDay
)
sd
=
fDay
;
if
(
ed
>
eDay
)
ed
=
eDay
;
if
(
ed
>
eDay
)
ed
=
eDay
;
for
(
let
day
=
fDay
;
day
<=
eDay
;
day
+=
(
60
*
60
*
24
*
1000
)
)
{
for
(
let
day
=
fDay
;
day
<=
eDay
;
day
+=
60
*
60
*
24
*
1000
)
{
const
elm
=
document
.
getElementById
(
day
);
const
elm
=
document
.
getElementById
(
day
);
elm
.
classList
.
remove
(
"
dragging
"
)
elm
.
classList
.
remove
(
"
dragging
"
)
;
}
}
const
elm2
=
document
.
getElementById
(
comp
);
const
elm2
=
document
.
getElementById
(
comp
);
if
(
elm2
.
classList
.
contains
(
"
dragging
"
))
{
if
(
elm2
.
classList
.
contains
(
"
dragging
"
))
{
for
(
let
day
=
ed
;
day
>=
comp
;
day
-=
(
60
*
60
*
24
*
1000
)
)
{
for
(
let
day
=
ed
;
day
>=
comp
;
day
-=
60
*
60
*
24
*
1000
)
{
const
elm
=
document
.
getElementById
(
day
);
const
elm
=
document
.
getElementById
(
day
);
elm
.
classList
.
remove
(
"
dragging
"
)
elm
.
classList
.
remove
(
"
dragging
"
);
}
}
}
else
{
}
else
{
for
(
let
day
=
sd
;
day
<=
ed
;
day
+=
(
60
*
60
*
24
*
1000
)
)
{
for
(
let
day
=
sd
;
day
<=
ed
;
day
+=
60
*
60
*
24
*
1000
)
{
const
elm
=
document
.
getElementById
(
day
);
const
elm
=
document
.
getElementById
(
day
);
// console.log(elm, day);
// console.log(elm, day);
elm
.
classList
.
add
(
"
dragging
"
)
elm
.
classList
.
add
(
"
dragging
"
)
;
}
}
}
}
setUsingDate
({
setUsingDate
({
startDate
:
new
Date
(
sd
).
getFullYear
()
+
'
-
'
+
String
(
new
Date
(
sd
).
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
'
-
'
+
String
(
new
Date
(
sd
).
getDate
()).
padStart
(
2
,
"
0
"
),
startDate
:
endDate
:
new
Date
(
ed
).
getFullYear
()
+
'
-
'
+
String
(
new
Date
(
ed
).
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
'
-
'
+
String
(
new
Date
(
ed
).
getDate
()).
padStart
(
2
,
"
0
"
)
new
Date
(
sd
).
getFullYear
()
+
})
"
-
"
+
String
(
new
Date
(
sd
).
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
"
-
"
+
String
(
new
Date
(
sd
).
getDate
()).
padStart
(
2
,
"
0
"
),
endDate
:
new
Date
(
ed
).
getFullYear
()
+
"
-
"
+
String
(
new
Date
(
ed
).
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
"
-
"
+
String
(
new
Date
(
ed
).
getDate
()).
padStart
(
2
,
"
0
"
),
});
setFinish
(
true
);
setFinish
(
true
);
}
}
else
{
else
{
console
.
log
(
fDay
,
eDay
,
new
Date
(
fDay
),
new
Date
(
eDay
));
console
.
log
(
fDay
,
eDay
,
new
Date
(
fDay
),
new
Date
(
eDay
))
for
(
let
day
=
fDay
;
day
<=
eDay
;
day
+=
60
*
60
*
24
*
1000
)
{
for
(
let
day
=
fDay
;
day
<=
eDay
;
day
+=
(
60
*
60
*
24
*
1000
)){
const
elm
=
document
.
getElementById
(
day
);
const
elm
=
document
.
getElementById
(
day
);
elm
.
classList
.
remove
(
"
dragging
"
)
elm
.
classList
.
remove
(
"
dragging
"
)
;
}
}
// startDate = newDate.getFullYear() + '-' + (newDate.getMonth()+1) + '-' + newDate.getDate();
// startDate = newDate.getFullYear() + '-' + (newDate.getMonth()+1) + '-' + newDate.getDate();
setStartDate
(
newDate
.
getFullYear
()
+
'
-
'
+
String
(
newDate
.
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
'
-
'
+
String
(
newDate
.
getDate
()).
padStart
(
2
,
"
0
"
));
setStartDate
(
newDate
.
getFullYear
()
+
"
-
"
+
String
(
newDate
.
getMonth
()
+
1
).
padStart
(
2
,
"
0
"
)
+
"
-
"
+
String
(
newDate
.
getDate
()).
padStart
(
2
,
"
0
"
)
);
const
elm
=
document
.
getElementById
(
newDate
-
0
);
const
elm
=
document
.
getElementById
(
newDate
-
0
);
elm
.
classList
.
add
(
"
dragging
"
)
elm
.
classList
.
add
(
"
dragging
"
)
;
// console.log("s", startDate);
// console.log("s", startDate);
setFinish
(
false
);
setFinish
(
false
);
}
}
}
}
;
const
removeDrag
=
(
newDate
)
=>
{
const
removeDrag
=
(
newDate
)
=>
{
for
(
let
day
=
fDay
;
day
<=
eDay
;
day
+=
(
60
*
60
*
24
*
1000
)
)
{
for
(
let
day
=
fDay
;
day
<=
eDay
;
day
+=
60
*
60
*
24
*
1000
)
{
const
elm
=
document
.
getElementById
(
day
);
const
elm
=
document
.
getElementById
(
day
);
elm
.
classList
.
remove
(
"
dragging
"
)
elm
.
classList
.
remove
(
"
dragging
"
)
;
}
}
// const elm = document.getElementById(newDate - 0);
// const elm = document.getElementById(newDate - 0);
// elm.classList.add("dragging")
// elm.classList.add("dragging")
// console.log(`${newDate.getFullYear()}-${newDate.getMonth()+1}-${newDate.getDate()}`)
// console.log(`${newDate.getFullYear()}-${newDate.getMonth()+1}-${newDate.getDate()}`)
}
}
;
for
(
let
day
=
fDay
;
day
<=
eDay
;
day
+=
(
60
*
60
*
24
*
1000
)
)
{
for
(
let
day
=
fDay
;
day
<=
eDay
;
day
+=
60
*
60
*
24
*
1000
)
{
const
tmpArr
=
[];
const
tmpArr
=
[];
for
(
let
i
=
0
;
i
<
7
;
i
++
)
{
for
(
let
i
=
0
;
i
<
7
;
i
++
)
{
let
cn
=
"
cella
"
;
let
cn
=
"
cella
"
;
...
@@ -174,32 +276,47 @@ function MakeCell({ nowYear, nowMonth, usingDate, setUsingDate, startDate, endDa
...
@@ -174,32 +276,47 @@ function MakeCell({ nowYear, nowMonth, usingDate, setUsingDate, startDate, endDa
if
(
newDate
.
getMonth
()
+
1
!==
nowMonth
)
cn
=
"
cellb
"
;
if
(
newDate
.
getMonth
()
+
1
!==
nowMonth
)
cn
=
"
cellb
"
;
// console.log(startDate, endDate);
// console.log(startDate, endDate);
// console.log(new Date(day), new Date(startDate+'T00:00:00'), new Date(endDate+'T00:00:00'))
// console.log(new Date(day), new Date(startDate+'T00:00:00'), new Date(endDate+'T00:00:00'))
if
(
day
>=
new
Date
(
startDate
+
'
T00:00:00
'
)
-
0
&&
day
<=
new
Date
(
endDate
+
'
T00:00:00
'
)
-
0
){
if
(
day
>=
new
Date
(
startDate
+
"
T00:00:00
"
)
-
0
&&
day
<=
new
Date
(
endDate
+
"
T00:00:00
"
)
-
0
)
{
cn
+=
"
dragging
"
;
cn
+=
"
dragging
"
;
tmpArr
.
push
(
tmpArr
.
push
(
<
TableCell
k
=
{
day
}
cn
=
{
cn
}
handleClick
=
{
handleClick
}
newDate
=
{
newDate
}
hds
=
{
handleDragStart
}
hdw
=
{
handleDragWhile
}
hde
=
{
handleDragEnd
}
i
=
{
i
}
value
=
{
newDate
.
getDate
()
}
/>
<
TableCell
k
=
{
day
}
cn
=
{
cn
}
handleClick
=
{
handleClick
}
newDate
=
{
newDate
}
hds
=
{
handleDragStart
}
hdw
=
{
handleDragWhile
}
hde
=
{
handleDragEnd
}
i
=
{
i
}
value
=
{
newDate
.
getDate
()
}
/>
);
);
}
}
else
{
else
{
tmpArr
.
push
(
tmpArr
.
push
(
<
TableCell
k
=
{
day
}
cn
=
{
cn
}
handleClick
=
{
handleClick
}
newDate
=
{
newDate
}
hds
=
{
handleDragStart
}
hdw
=
{
handleDragWhile
}
hde
=
{
handleDragEnd
}
i
=
{
i
}
value
=
{
newDate
.
getDate
()
}
/>
<
TableCell
k
=
{
day
}
cn
=
{
cn
}
handleClick
=
{
handleClick
}
newDate
=
{
newDate
}
hds
=
{
handleDragStart
}
hdw
=
{
handleDragWhile
}
hde
=
{
handleDragEnd
}
i
=
{
i
}
value
=
{
newDate
.
getDate
()
}
/>
);
);
}
}
day
+=
(
60
*
60
*
24
*
1000
)
day
+=
60
*
60
*
24
*
1000
;
}
}
calendarArr
.
push
(
calendarArr
.
push
(<
tr
>
{
tmpArr
}
</
tr
>);
<
tr
>
{
tmpArr
}
</
tr
>
);
day
-=
(
60
*
60
*
24
*
1000
)
day
-=
60
*
60
*
24
*
1000
;
}
}
return
<
tbody
>
{
calendarArr
}
</
tbody
>;
return
(
<
tbody
>
{
calendarArr
}
</
tbody
>
);
}
}
function
CalendarMonth
({
usingDate
,
setUsingDate
})
{
function
CalendarMonth
({
usingDate
,
setUsingDate
})
{
...
@@ -222,7 +339,7 @@ function CalendarMonth({ usingDate, setUsingDate }){
...
@@ -222,7 +339,7 @@ function CalendarMonth({ usingDate, setUsingDate }){
}
}
setNowMonth
(
newMonth
);
setNowMonth
(
newMonth
);
setCurrentDay
(
new
Date
(
nowYear
,
nowMonth
,
nowDate
));
setCurrentDay
(
new
Date
(
nowYear
,
nowMonth
,
nowDate
));
}
}
;
const
nextMonth
=
()
=>
{
const
nextMonth
=
()
=>
{
let
newMonth
=
nowMonth
+
1
;
let
newMonth
=
nowMonth
+
1
;
if
(
newMonth
>
12
)
{
if
(
newMonth
>
12
)
{
...
@@ -231,16 +348,29 @@ function CalendarMonth({ usingDate, setUsingDate }){
...
@@ -231,16 +348,29 @@ function CalendarMonth({ usingDate, setUsingDate }){
}
}
setNowMonth
(
newMonth
);
setNowMonth
(
newMonth
);
setCurrentDay
(
new
Date
(
nowYear
,
nowMonth
,
nowDate
));
setCurrentDay
(
new
Date
(
nowYear
,
nowMonth
,
nowDate
));
}
}
;
return
(
return
(
<
div
className
=
"calendar"
>
<
div
className
=
"calendar"
>
<
h1
>
달력
</
h1
>
<
h1
>
달력
</
h1
>
<
MakeHeader
nowMonth
=
{
nowMonth
}
prevMonth
=
{
prevMonth
}
nextMonth
=
{
nextMonth
}
></
MakeHeader
>
<
MakeHeader
nowMonth
=
{
nowMonth
}
prevMonth
=
{
prevMonth
}
nextMonth
=
{
nextMonth
}
></
MakeHeader
>
<
h1
>
{
nowYear
}
</
h1
>
<
h1
>
{
nowYear
}
</
h1
>
<
table
className
=
"calendarTable"
>
<
table
className
=
"calendarTable"
>
<
MakeDay
/>
<
MakeDay
/>
<
MakeCell
nowYear
=
{
nowYear
}
nowMonth
=
{
nowMonth
}
usingDate
=
{
usingDate
}
setUsingDate
=
{
setUsingDate
}
startDate
=
{
startDate
}
endDate
=
{
endDate
}
setStartDate
=
{
setStartDate
}
setEndDate
=
{
setEndDate
}
></
MakeCell
>
<
MakeCell
nowYear
=
{
nowYear
}
nowMonth
=
{
nowMonth
}
usingDate
=
{
usingDate
}
setUsingDate
=
{
setUsingDate
}
startDate
=
{
startDate
}
endDate
=
{
endDate
}
setStartDate
=
{
setStartDate
}
setEndDate
=
{
setEndDate
}
></
MakeCell
>
</
table
>
</
table
>
</
div
>
</
div
>
);
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment