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 16:51:40 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
6c957d56c677a17d3590942f69286b36fe9db1d7
6c957d56
2 parents
18622cfa
ae2e4eac
Update holiday date logic
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
85 additions
and
17 deletions
nodejs/README.md → README.md
nodejs/package-lock.json
nodejs/public/css/main.css
nodejs/server.js
nodejs/views/data.ejs
nodejs/
README.md
→
README.md
View file @
6c957d5
...
...
@@ -2,7 +2,7 @@
---
공휴일
·기념일
카운터 및 활동 추천
공휴일 카운터 및 활동 추천
## Getting Started (Installation)
...
...
nodejs/package-lock.json
View file @
6c957d5
...
...
@@ -9,13 +9,14 @@
"version"
:
"1.0.0"
,
"license"
:
"ISC"
,
"dependencies"
:
{
"ejs"
:
"^3.1.
7
"
,
"ejs"
:
"^3.1.
8
"
,
"express"
:
"^4.18.1"
,
"fs"
:
"^0.0.1-security"
,
"request"
:
"^2.88.2"
,
"xml-js"
:
"^1.6.11"
,
"xml2js"
:
"^0.4.23"
}
},
"devDependencies"
:
{}
},
"node_modules/accepts"
:
{
"version"
:
"1.3.8"
,
...
...
@@ -315,9 +316,9 @@
"integrity"
:
"sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
},
"node_modules/ejs"
:
{
"version"
:
"3.1.
7
"
,
"resolved"
:
"https://registry.npmjs.org/ejs/-/ejs-3.1.
7
.tgz"
,
"integrity"
:
"sha512-
BIar7R6abbUxDA3bfXrO4DSgwo8I+fB5/1zgujl3HLLjwd6+9iOnrT+t3grn2qbk9vOgBubXOFwX2m9axoFaGw
=="
,
"version"
:
"3.1.
8
"
,
"resolved"
:
"https://registry.npmjs.org/ejs/-/ejs-3.1.
8
.tgz"
,
"integrity"
:
"sha512-
/sXZeMlhS0ArkfX2Aw780gJzXSMPnKjtspYZv+f3NiKLlubezAHDU5+9xz6gd3/NhG3txQCo6xlglmTS+oTGEQ
=="
,
"dependencies"
:
{
"jake"
:
"^10.8.5"
},
...
...
@@ -1412,9 +1413,9 @@
"integrity"
:
"sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
},
"ejs"
:
{
"version"
:
"3.1.
7
"
,
"resolved"
:
"https://registry.npmjs.org/ejs/-/ejs-3.1.
7
.tgz"
,
"integrity"
:
"sha512-
BIar7R6abbUxDA3bfXrO4DSgwo8I+fB5/1zgujl3HLLjwd6+9iOnrT+t3grn2qbk9vOgBubXOFwX2m9axoFaGw
=="
,
"version"
:
"3.1.
8
"
,
"resolved"
:
"https://registry.npmjs.org/ejs/-/ejs-3.1.
8
.tgz"
,
"integrity"
:
"sha512-
/sXZeMlhS0ArkfX2Aw780gJzXSMPnKjtspYZv+f3NiKLlubezAHDU5+9xz6gd3/NhG3txQCo6xlglmTS+oTGEQ
=="
,
"requires"
:
{
"jake"
:
"^10.8.5"
}
...
...
nodejs/public/css/main.css
View file @
6c957d5
...
...
@@ -39,9 +39,15 @@ h3 {
font-weight
:
600
;
}
#activity
{
<<<<<<<
HEAD
width
:
1000px
;
height
:
fit-content
;
border-radius
:
10
p
10px
/
10px
10px
;
=======
width
:
fit-content
;
height
:
fit-content
;
border-radius
:
40px
80px
/
80px
40px
;
>>>>>>>
ae2e4eac4bff94c5b55f982450db9baabf3fab50
background-color
:
rgba
(
197
,
97
,
201
,
0.486
);
}
body
{
...
...
nodejs/server.js
View file @
6c957d5
...
...
@@ -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
...
...
@@ -40,7 +40,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
;
}
...
...
@@ -56,7 +56,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
();
...
...
@@ -119,7 +119,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
...
...
@@ -141,8 +141,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
();
}
...
...
@@ -169,7 +175,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
();
...
...
nodejs/views/data.ejs
View file @
6c957d5
...
...
@@ -28,6 +28,7 @@
</p>
</div>
</div>
<<<<<<
< HEAD
<
h2
>
[
<
%= data[0] %>] 추천 활동
</h2>
<!--recommend activity 추가파트 시작-->
<div
id=
"activity"
>
...
...
@@ -39,13 +40,62 @@
<h2>
2. 놀이공원
</h2>
<h2>
3. 서울숲
</h2>
<
% } else if (data[1] == '20220606') { %>
=======
<h2>
<
%= data[0] %> 에 추천하는 활동 목록입니다.
</h2>
<!--recommend activity 추가파트 시작-->
<div
id=
"activity"
>
<
% if (data[0] == '전국동시지방선거') { %>
<h2>
1. 투표하세요.
</h2>
<h2>
2. 투표날이 어렵다면 사전투표하세요.
</h2>
<
% } else if (data[0] == '어린이날') { %>
<h2>
1. 어린이날 즐기기.
</h2>
<h2>
2. 놀이공원
</h2>
<h2>
3. 서울숲
</h2>
<
% } else if (data[0] == '현충일') { %>
>>>>>>> ae2e4eac4bff94c5b55f982450db9baabf3fab50
<h2>
1. 현충원 가기.
</h2>
<h2>
2. 전쟁기념관 방문.
</h2>
<h2>
3. 어린이날 즐기기.
</h2>
<<<<<<
< HEAD
<%
}
else
if
(
data
[
1
]
==
'
20220508
')
{
%
>
<h2>
절 가기.
</h2>
=======
<
% } else if (data[0] == '석가탄신일') { %>
<h2>
절 가기.
</h2>
<
% } else if (data[0] == '부처님오신날') { %>
<h2>
절 가기.
</h2>
<
% } else if (data[0] == '1월1일') { %>
<h2>
Happy new year!
</h2>
<
% } else if (data[0] == '설날') { %>
<h2>
새해 복 많이 받으세요.
</h2>
<
% } else if (data[0] == '삼일절') { %>
<h2>
대한독립만세
</h2>
<
% } else if (data[0] == '광복절') { %>
<h2>
대한독립만세
</h2>
<
% } else if (data[0] == '추석') { %>
<h2>
추석입니다. 풍요로운 한가위 되세요.
</h2>
<
% } else if (data[0] == '개천절') { %>
<h2>
개천절입니다.
</h2>
<
% } else if (data[0] == '한글날') { %>
<h2>
바른말 고운말
</h2>
<
% } else if (data[0] == '기독탄신일') { %>
<h2>
메리 크리스마스!
</h2>
<
% } else if (data[0] == '임시공휴일') {%>
<h2>
보너스 휴일
</h2>
<
% } else if (data[0] == '대체공휴일') {%>
<h2>
보너스 휴일
</h2>
<
% } else if (data[0] == '대체휴무일') {%>
<h2>
보너스 휴일
</h2>
<
% } else if (data[0] == '대통령선거일') {%>
<h2>
1. 투표하세요.
</h2>
<h2>
2. 투표날이 어렵다면 사전투표하세요.
</h2>
>>>>>>> ae2e4eac4bff94c5b55f982450db9baabf3fab50
<
% } else { %>
<h2>
Just Take some rest!.
</h2>
...
...
@@ -54,8 +104,13 @@
<<<<<<
< HEAD
=======
>
>>>>>> ae2e4eac4bff94c5b55f982450db9baabf3fab50
</div>
<div
id=
"loading"
><div
class=
"spinner"
></div></div>
</body>
</center>
</html>
\ No newline at end of file
...
...
Please
register
or
login
to post a comment