박지환

Fix time set error

...@@ -32,12 +32,8 @@ app.use(static(__dirname)); ...@@ -32,12 +32,8 @@ app.use(static(__dirname));
32 32
33 // To get today date by using Date 33 // To get today date by using Date
34 function getTodayDate() { 34 function getTodayDate() {
35 - var tempDate = new Date(); 35 + var today = new Date();
36 - console.log("[tempDate] " + tempDate); 36 + console.log(today);
37 - const utc = tempDate.getTime() + tempDate.getTimezoneOffset() * 60 * 1000;
38 - const KR_TIME_DIFF = 9 * 60 * 60 * 1000;
39 - const today = new Date(utc + KR_TIME_DIFF);
40 - console.log("[today] " + today);
41 var year = today.getFullYear(); 37 var year = today.getFullYear();
42 var month = ("0" + (today.getMonth() + 1)).slice(-2); 38 var month = ("0" + (today.getMonth() + 1)).slice(-2);
43 var day = ("0" + today.getDate()).slice(-2); 39 var day = ("0" + today.getDate()).slice(-2);
...@@ -46,13 +42,6 @@ function getTodayDate() { ...@@ -46,13 +42,6 @@ function getTodayDate() {
46 return dateString; 42 return dateString;
47 } 43 }
48 44
49 -function test() {
50 - var tempDate = new Date(); // Locale time
51 - const utc = tempDate.getTime() + tempDate.getTimezoneOffset() * 60 * 1000; // Calculate UTC time
52 - const KR_TIME_DIFF = 9 * 60 * 60 * 1000; // UTC to KST (UTC + 9 hours)
53 - return utc + KR_TIME_DIFF;
54 -}
55 -
56 // To get modified date from locdate 45 // To get modified date from locdate
57 function getModifiedDate(locdate) { 46 function getModifiedDate(locdate) {
58 return ( 47 return (
...@@ -214,11 +203,6 @@ app.get("/app", function (req, res) { ...@@ -214,11 +203,6 @@ app.get("/app", function (req, res) {
214 ); 203 );
215 }); 204 });
216 205
217 -app.get("/test", function (req, res) {
218 - init();
219 - res.send(Date() + "<br>" + Date(test()) + "<br>" + test());
220 -});
221 -
222 init(); 206 init();
223 207
224 const port = 8080; 208 const port = 8080;
......