From deea4b0955fc3186353806a982ec7e76979164c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kimjh=28=EA=B9=80=EC=9E=A5=ED=98=84=29?= Date: Thu, 6 Oct 2022 18:03:27 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B9=84=ED=96=89=EC=9A=B4=ED=95=AD=20?= =?UTF-8?q?=EC=8A=A4=EC=BC=80=EC=A4=84=20=EC=8B=9C=EA=B0=84=ED=91=9C?= =?UTF-8?q?=EC=8B=9C=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 | 37 ++++++------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/src/components/basis/flight/schedule/FlightScheduleGrid.js b/src/components/basis/flight/schedule/FlightScheduleGrid.js index 1c05f18..4d1a29a 100644 --- a/src/components/basis/flight/schedule/FlightScheduleGrid.js +++ b/src/components/basis/flight/schedule/FlightScheduleGrid.js @@ -5,8 +5,6 @@ import FlightScheduleRealTime from './FlightScheduleRealTime'; import { useSelector } from 'react-redux'; import moment from 'moment'; -const KR_TIME_DIFF = 9 * 60 * 60 * 1000; - /** * 비행 전 : B * 비행 중 : F @@ -67,7 +65,7 @@ function FlightScheduleGrid() { minWidth: '150px', sortable: true, cell: row => { - return moment(row.schFltStDt).format('HH:mm'); + return moment(row.schFltStDt).format('YYYY-MM-DD HH:mm'); } }, { @@ -85,7 +83,7 @@ function FlightScheduleGrid() { minWidth: '150px', sortable: true, cell: row => { - return moment(row.schFltEndDt).format('HH:mm'); + return moment(row.schFltEndDt).format('YYYY-MM-DD HH:mm'); } }, { @@ -94,23 +92,14 @@ function FlightScheduleGrid() { minWidth: '150px', sortable: true, cell: row => { - const endDate = new Date(row.schFltEndDt); - const startDate = new Date(row.schFltStDt); - - const timeDiff = endDate - startDate; + const endDate = moment(row.schFltEndDt); + const startDate = moment(row.schFltStDt); - let hours = fillZero( - 2, - String( - Math.floor((timeDiff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)) - ) - ); - let minute = fillZero( - 2, - String(Math.floor((timeDiff % (1000 * 60 * 60)) / (1000 * 60))) - ); + const hours = moment.duration(endDate.diff(startDate)).asHours(); + const minute = + moment.duration(endDate.diff(startDate)).asMinutes() % 60; - return `${hours}:${minute}`; + return `${fillZero(2, String(hours))} : ${fillZero(2, String(minute))}`; } }, { @@ -130,13 +119,6 @@ function FlightScheduleGrid() { } } ]; - /** - * 비행상태가 완료이면 회색 - - 비행전 || 비행중 - 비행시작시간이 현재시간 10분 지연이거나 || 비행종료시간이 현재시간 10분 초과시 - 노란색 - */ const conditionalRowStyles = [ { @@ -262,6 +244,9 @@ function FlightScheduleGrid() { } // 비행중 체크 if (row.statusCd === 'F') { + if (currDay - itemEndDay < 0) { + return false; + } if (currTime - itemEndTime >= 39) { return true; }