From af44093e3a1693658f0f91218e0df4eee0c56ebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kimjh=28=EA=B9=80=EC=9E=A5=ED=98=84=29?= Date: Fri, 11 Nov 2022 10:02:21 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9A=B4=ED=95=AD=20=EC=8A=A4=EC=BC=80?= =?UTF-8?q?=EC=A4=84=20=EB=B9=84=ED=96=89=EC=A4=91=20=EC=8B=9C=EA=B0=84?= =?UTF-8?q?=EC=B2=B4=ED=81=AC=20=EC=9D=B4=EC=8A=88=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flight/schedule/FlightScheduleGrid.js | 40 +++++++++++++++---- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/src/components/basis/flight/schedule/FlightScheduleGrid.js b/src/components/basis/flight/schedule/FlightScheduleGrid.js index 26a96dd0..34d238f7 100644 --- a/src/components/basis/flight/schedule/FlightScheduleGrid.js +++ b/src/components/basis/flight/schedule/FlightScheduleGrid.js @@ -139,6 +139,7 @@ function FlightScheduleGrid() { // 현재날짜 const currDay = Number(moment().format('YYYYMMDD')); + const currDateTime = moment(); // 데이터 시작날짜 // const itemStartDay = Number(moment(row.schFltStDt).format('YYYYMMDD')); @@ -146,7 +147,15 @@ function FlightScheduleGrid() { const itemEndDay = Number(moment(row.schFltEndDt).format('YYYYMMDD')); const itemStartTime = moment(row.schFltStDt).format('HHmm'); - const itemEndTime = moment(row.schFltEndDt).format('HHmm'); + const itemEndTime = moment(row.schFltEndDt); + const diffTime = + moment.duration(currDateTime.diff(itemEndTime)).asMinutes() % 60 > + -0 + ? moment.duration(currDateTime.diff(itemEndTime)).asMinutes() % 60 + : Math.ceil( + moment.duration(currDateTime.diff(itemEndTime)).asMinutes() % + 60 + ); // 현재날짜 - 종료날짜 if (currDay - itemEndDay > 0) { @@ -162,7 +171,7 @@ function FlightScheduleGrid() { return false; } if (row.statusCd === 'F') { - if (currTime - itemEndTime >= 10 && currTime - itemEndTime <= 19) { + if (diffTime >= 10 && diffTime <= 19) { return true; } return false; @@ -182,6 +191,7 @@ function FlightScheduleGrid() { .substring(0, 4); // 현재날짜 const currDay = Number(moment().format('YYYYMMDD')); + const currDateTime = moment(); // 데이터 시작날짜 // const itemStartDay = Number(moment(row.schFltStDt).format('YYYYMMDD')); @@ -189,7 +199,15 @@ function FlightScheduleGrid() { const itemEndDay = Number(moment(row.schFltEndDt).format('YYYYMMDD')); const itemStartTime = moment(row.schFltStDt).format('HHmm'); - const itemEndTime = moment(row.schFltEndDt).format('HHmm'); + const itemEndTime = moment(row.schFltEndDt); + const diffTime = + moment.duration(currDateTime.diff(itemEndTime)).asMinutes() % 60 > + -0 + ? moment.duration(currDateTime.diff(itemEndTime)).asMinutes() % 60 + : Math.ceil( + moment.duration(currDateTime.diff(itemEndTime)).asMinutes() % + 60 + ); // 현재날짜 - 종료날짜 if (currDay - itemEndDay > 0) { @@ -207,7 +225,7 @@ function FlightScheduleGrid() { } // 비행중 체크 if (row.statusCd === 'F') { - if (currTime - itemEndTime >= 20 && currTime - itemEndTime <= 29) { + if (diffTime >= 20 && diffTime <= 29) { return true; } return false; @@ -227,14 +245,22 @@ function FlightScheduleGrid() { .substring(0, 4); // 현재날짜 const currDay = Number(moment().format('YYYYMMDD')); - + const currDateTime = moment(); // 데이터 시작날짜 // const itemStartDay = Number(moment(row.schFltStDt).format('YYYYMMDD')); // 데이터 종료날짜 const itemEndDay = Number(moment(row.schFltEndDt).format('YYYYMMDD')); const itemStartTime = moment(row.schFltStDt).format('HHmm'); - const itemEndTime = moment(row.schFltEndDt).format('HHmm'); + const itemEndTime = moment(row.schFltEndDt); + const diffTime = + moment.duration(currDateTime.diff(itemEndTime)).asMinutes() % 60 > + -0 + ? moment.duration(currDateTime.diff(itemEndTime)).asMinutes() % 60 + : Math.ceil( + moment.duration(currDateTime.diff(itemEndTime)).asMinutes() % + 60 + ); // 현재날짜 - 종료날짜 if (currDay - itemEndDay > 0) { @@ -252,7 +278,7 @@ function FlightScheduleGrid() { if (currDay - itemEndDay < 0) { return false; } - if (currTime - itemEndTime > 30) { + if (diffTime > 30) { return true; } return false;