From ca027f29c64ecb0efc9b54bba628028582f90fa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EC=84=9D=20=EC=B5=9C?= Date: Tue, 8 Nov 2022 11:57:22 +0900 Subject: [PATCH] =?UTF-8?q?dateTimeCalc=20=ED=95=A8=EC=88=98=20=EC=9C=84?= =?UTF-8?q?=EC=B9=98=20=EB=B3=80=EA=B2=BD.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/static/js/common.js | 19 ++++++++++++++++++- .../static/js/faStatistics/crackdownStatus.js | 17 ----------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/resources/static/js/common.js b/src/main/resources/static/js/common.js index 023b650d..c1e9c83e 100644 --- a/src/main/resources/static/js/common.js +++ b/src/main/resources/static/js/common.js @@ -205,9 +205,26 @@ function departmentDynamicOption(targetTagName, code, defaultOptionName='') { $(targetTagName).empty(); let option = ''; organConfigList.forEach(function (organConfig) { - if (organConfig.parentOrgan != null && organConfig.organType != 'OGC002' && organConfig.parentOrgan == code) { + if (organConfig.parentOrgan != null && organConfig.organType !== 'OGC002' && organConfig.parentOrgan === code) { option += ''; } }); $(targetTagName).append('' + option); +} + +function dateTimeCalc(startDateTime, endDateTime) { + if (startDateTime !== '' &&endDateTime !== '' && startDateTime !== undefined && endDateTime !== undefined) { + const startDate = new Date(startDateTime); + const endDate = new Date(endDateTime); + + let diffTime = endDate.getTime() - startDate.getTime(); + + const day = Math.floor(diffTime / (1000* 60 * 60 * 24)); + const hour = Math.floor((diffTime % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); + const minute = Math.floor((diffTime % (1000 * 60 * 60)) / (1000 * 60)); + + return day + '일' + hour + '시간' + minute + '분'; + } + + return null; } \ No newline at end of file diff --git a/src/main/resources/static/js/faStatistics/crackdownStatus.js b/src/main/resources/static/js/faStatistics/crackdownStatus.js index c856cf2a..da1d9642 100644 --- a/src/main/resources/static/js/faStatistics/crackdownStatus.js +++ b/src/main/resources/static/js/faStatistics/crackdownStatus.js @@ -459,20 +459,3 @@ function getToday() { var date = new Date(); var year = date.getFullYear(); } - -function dateTimeCalc(startDateTime, endDateTime) { - if (startDateTime != '' &&endDateTime != '' && startDateTime != undefined && endDateTime != undefined) { - const startDate = new Date(startDateTime); - const endDate = new Date(endDateTime); - - let diffTime = endDate.getTime() - startDate.getTime(); - - const day = Math.floor(diffTime / (1000* 60 * 60 * 24)); - const hour = Math.floor((diffTime % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); - const minute = Math.floor((diffTime % (1000 * 60 * 60)) / (1000 * 60)); - - return day + '일' + hour + '시간' + minute + '분'; - } - - return null; -}