박지환

Test time set

...@@ -32,12 +32,24 @@ app.use(static(__dirname)); ...@@ -32,12 +32,24 @@ 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 today = new Date(); 35 + const tempDate = new Date();
36 - console.log(today); 36 + console.log(tempDate.getTimezoneOffset());
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);
37 var year = today.getFullYear(); 40 var year = today.getFullYear();
38 var month = ("0" + (today.getMonth() + 1)).slice(-2); 41 var month = ("0" + (today.getMonth() + 1)).slice(-2);
39 var day = ("0" + today.getDate()).slice(-2); 42 var day = ("0" + today.getDate()).slice(-2);
40 var dateString = year + "-" + month + "-" + day; 43 var dateString = year + "-" + month + "-" + day;
44 + console.log(
45 + dateString +
46 + "-" +
47 + today.getHours() +
48 + "-" +
49 + today.getMinutes() +
50 + "-" +
51 + today.getSeconds()
52 + );
41 // return "2022-12-25"; // 테스트용 날짜를 입력하세요. *** 테스트가 끝나면 주석처리하고 커밋해주세요. *** ex) 2022-09-12, 2022-09-15, 2022-10-04 53 // return "2022-12-25"; // 테스트용 날짜를 입력하세요. *** 테스트가 끝나면 주석처리하고 커밋해주세요. *** ex) 2022-09-12, 2022-09-15, 2022-10-04
42 return dateString; 54 return dateString;
43 } 55 }
......