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; }