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-28 01:23:32 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ac79f262cbc41ff2d01b024eca74ba6ad2a24170
ac79f262
1 parent
9bf3d7cc
Change api operation
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
nodejs/server.js
nodejs/server.js
View file @
ac79f26
...
...
@@ -9,7 +9,7 @@ const static = require("serve-static");
// Modify the values as needed
var
year
=
"2022"
;
var
month
=
"09"
;
var
operation
=
"get
Holi
DeInfo"
;
var
operation
=
"get
Rest
DeInfo"
;
// Do not modify the values
var
SERVEICE_KEY
=
...
...
@@ -38,7 +38,7 @@ function getTodayDate() {
var
month
=
(
"0"
+
(
today
.
getMonth
()
+
1
)).
slice
(
-
2
);
var
day
=
(
"0"
+
today
.
getDate
()).
slice
(
-
2
);
var
dateString
=
year
+
"-"
+
month
+
"-"
+
day
;
// return "2022-1
0-04
"; // 테스트용 날짜를 입력하세요. 테스트가 끝나면 주석처리 하세요. ex) 2022-09-12, 2022-09-15, 2022-10-04
// return "2022-1
2-27
"; // 테스트용 날짜를 입력하세요. 테스트가 끝나면 주석처리 하세요. ex) 2022-09-12, 2022-09-15, 2022-10-04
return
dateString
;
}
...
...
@@ -54,7 +54,7 @@ function getModifiedDate(locdate) {
}
// To get remaining days from locdate
function
getLeftDate
(
dateName
,
locdate
)
{
function
getLeftDate
(
locdate
)
{
var
today
=
new
Date
(
getTodayDate
());
// today date
var
holiday
=
new
Date
(
getModifiedDate
(
locdate
));
// holiday date
var
diffDate
=
today
.
getTime
()
-
holiday
.
getTime
();
...
...
@@ -117,7 +117,7 @@ function getData() {
console
.
log
(
locdate
);
var
holiArr
=
[];
for
(
var
i
=
0
;
i
<
dateName
.
length
;
i
++
)
{
holiArr
.
push
(
getLeftDate
(
dateName
[
i
],
locdate
[
i
]));
holiArr
.
push
(
getLeftDate
(
locdate
[
i
]));
}
console
.
log
(
holiArr
);
// Create tempArr to save dateName and locdate and leftDate at once
...
...
@@ -139,8 +139,14 @@ function getData() {
console
.
log
(
"이번 달에는 남은 공휴일이 없습니다. 다음달 데이터를 불러옵니다."
);
// Get next month data
month
=
String
(
Number
(
month
)
+
1
).
padStart
(
2
,
"0"
);
if
(
Number
(
month
)
<
12
)
{
// Get next month data
month
=
String
(
Number
(
month
)
+
1
).
padStart
(
2
,
"0"
);
}
else
{
// Get next year data
year
=
String
(
Number
(
year
)
+
1
).
padStart
(
4
,
"0"
);
month
=
"01"
;
}
changeParams
(
year
,
month
,
operation
);
getData
();
}
...
...
@@ -167,7 +173,7 @@ function init() {
var
date
=
getTodayDate
().
split
(
"-"
);
year
=
date
[
0
];
month
=
date
[
1
];
operation
=
"get
Holi
DeInfo"
;
operation
=
"get
Rest
DeInfo"
;
changeParams
(
year
,
month
,
operation
);
// Get data from holiday api
getData
();
...
...
Please
register
or
login
to post a comment