Toggle navigation
Toggle navigation
This project
Loading...
Sign in
teamPARK
/
holiday-counter-recommend-activity
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
박지환
2022-05-13 17:18:36 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5c4369908061ea40db8c6dde24e7324e9eb99da1
5c436990
1 parent
962f15a3
Add d-day count in ejs
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
11 deletions
feature-holiday-counter/app.js
server.js
views/data.ejs
feature-holiday-counter/app.js
View file @
5c43699
const
today
=
new
Date
(
"2022-05-12"
);
//오늘 날짜 입력
const
today
=
new
Date
();
//오늘 날짜 입력
const
holiday
=
new
Date
(
"2022-10-01"
);
//공휴일 날짜 입력
cons
t
diffDate
=
today
.
getTime
()
-
holiday
.
getTime
(
);
cons
ole
.
log
(
today
.
getMonth
()
+
1
);
const
dday
=
Math
.
abs
(
diffDate
/
(
1000
*
3600
*
24
));
const
diffDate
=
today
.
getTime
()
-
holiday
.
getTime
();
const
dday
=
Math
.
abs
(
diffDate
/
(
1000
*
3600
*
24
));
console
.
log
(
dday
);
...
...
server.js
View file @
5c43699
...
...
@@ -76,15 +76,22 @@ function init() {
}
let
i
=
0
;
let
length
=
dateName
.
length
;
while
(
i
<
length
){
var
holiArr
=
[];
while
(
i
<
length
)
{
var
temptoday
=
dateName
[
i
];
var
tempdate
=
locdate
[
i
];
var
modifiedDate
=
tempdate
.
substr
(
0
,
4
)
+
'-'
+
tempdate
.
substr
(
4
,
2
)
+
'-'
+
tempdate
.
substr
(
6
,
2
);
var
modifiedDate
=
tempdate
.
substr
(
0
,
4
)
+
"-"
+
tempdate
.
substr
(
4
,
2
)
+
"-"
+
tempdate
.
substr
(
6
,
2
);
var
today
=
new
Date
(
"2022-05-13"
);
//오늘 날짜 입력
var
holiday
=
new
Date
(
modifiedDate
);
//공휴일 날짜 입력
var
diffDate
=
today
.
getTime
()
-
holiday
.
getTime
();
var
dday
=
Math
.
abs
(
diffDate
/
(
1000
*
3600
*
24
));
console
.
log
(
temptoday
+
"까지 "
+
dday
+
"일 남았습니다."
);
var
diffDate
=
today
.
getTime
()
-
holiday
.
getTime
();
var
dday
=
Math
.
abs
(
diffDate
/
(
1000
*
3600
*
24
));
console
.
log
(
temptoday
+
"까지 "
+
dday
+
"일 남았습니다."
);
holiArr
.
push
(
dday
);
i
++
;
}
console
.
log
(
locdate
);
...
...
@@ -92,6 +99,7 @@ function init() {
tempArr
=
[];
tempArr
.
push
(
dateName
);
tempArr
.
push
(
locdate
);
tempArr
.
push
(
holiArr
);
console
.
log
(
tempArr
);
});
}
...
...
@@ -99,8 +107,6 @@ function init() {
});
}
app
.
get
(
"/"
,
function
(
req
,
res
)
{
init
();
// Send data from nodejs to ejs
...
...
views/data.ejs
View file @
5c43699
...
...
@@ -11,7 +11,7 @@
<body>
<
% for(var i = 0; i
< data
[
0
].
length
;
i
++)
{%
>
<p>
<h1>
<
%= data[0][i] %>
<
%= data[1][i] %>
</h1>
<h1>
<
%= data[0][i] %>
<
%= data[1][i] %>
<
%= data[2][i] %>일 남았습니다.
</h1>
</p>
<
% } %>
</body>
...
...
Please
register
or
login
to post a comment