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
reservation-service
Commits
94e62592
Commit
94e62592
authored
Nov 05, 2020
by
Choi Ga Young
Browse files
날짜비교 실패
parent
06c802e0
Changes
2
Hide whitespace changes
Inline
Side-by-side
server/client/src/Pages/ApplyPage.js
View file @
94e62592
...
...
@@ -137,7 +137,7 @@ function Apply(props) {
selected
=
{
values
.
date
}
name
=
"
date
"
onChange
=
{
date
=>
setFieldValue
(
'
date
'
,
date
)}
dateFormat
=
"
yyyy.MM.dd
(eee)
"
dateFormat
=
"
yyyy.MM.dd
"
placeholderText
=
"
yyyy-mm-dd
"
minDate
=
{
new
Date
()}
/
>
...
...
server/routes/reserves.js
View file @
94e62592
...
...
@@ -35,14 +35,11 @@ router.post('/', function (req, res, next) {
console
.
error
(
err
);
next
(
err
);
});
}
const
strt
=
new
Date
(
reserve
.
start
)
const
endt
=
new
Date
(
reserve
.
end
)
};
const
reserveArr
=
reserves
.
map
(
item
=>
(
(
strt
>=
new
Date
(
item
.
start
)
&&
strt
<
new
Date
(
item
.
end
))
||
(
endt
>
new
Date
(
item
.
start
)
&&
endt
<=
new
Date
(
item
.
end
))
?
"
item
"
:
null
(
reserve
.
start
>=
item
.
start
&&
reserve
.
start
<
item
.
end
)
||
(
reserve
.
end
>
item
.
start
&&
reserve
.
end
<=
item
.
end
)
?
"
item
"
:
null
))
console
.
log
(
"
array
"
,
reserveArr
)
if
(
!
reserveArr
.
includes
(
"
item
"
))
{
...
...
@@ -75,16 +72,21 @@ router.get('/:_id', verifyToken, function (req, res, next) {
console
.
log
(
'
/reserves get req.params
'
,
req
.
params
)
Reserve
.
find
({
user
:
req
.
params
.
_id
},
function
(
err
,
reserve
)
{
if
(
err
)
return
res
.
status
(
500
).
json
({
error
:
err
});
//
console.log(
reserve, Date.now
())
console
.
log
(
'
/change date
'
,
new
Date
())
const
reserves
=
reserve
.
map
(
item
=>
(
new
Date
(
item
.
end
)
>=
Date
.
now
()
?
item
:
""
//console.log('/item', item),
console
.
log
(
'
/item end
'
,
item
.
end
),
console
.
log
(
'
type check
'
,
typeof
item
.
end
),
console
.
log
(
'
type2 check
'
,
typeof
new
Date
()),
console
.
log
(
'
/now
'
,
new
Date
()),
item
.
end
>=
new
Date
()
?
item
:
""
));
if
(
!
reserves
)
{
console
.
log
(
"
no신청
"
)
res
.
status
(
404
).
json
({
error
:
"
신청내역이 없습니다.
"
})
console
.
log
(
"
no신청
"
)
res
.
status
(
404
).
json
({
error
:
"
신청내역이 없습니다.
"
})
}
console
.
log
(
"
reserves
"
,
reserves
)
console
.
log
(
"
reserves
"
,
reserves
)
res
.
status
(
201
).
json
(
reserves
);
})
});
...
...
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