diff --git a/src/pages/master/shift/component/DetailShift.jsx b/src/pages/master/shift/component/DetailShift.jsx index d8bd410..86d1b8d 100644 --- a/src/pages/master/shift/component/DetailShift.jsx +++ b/src/pages/master/shift/component/DetailShift.jsx @@ -2,6 +2,10 @@ import { useEffect, useState } from 'react'; import { Modal, Input, Typography, Switch, Button, ConfigProvider, Divider } from 'antd'; import { NotifAlert, NotifOk } from '../../../../components/Global/ToastNotif'; import { createShift, updateShift } from '../../../../api/master-shift'; +import dayjs from 'dayjs'; +import utc from 'dayjs/plugin/utc'; + +dayjs.extend(utc); const { Text } = Typography; @@ -198,16 +202,13 @@ const DetailShift = (props) => { }); }; - // Helper function to extract time from ISO timestamp + // Helper function to extract time from ISO timestamp using dayjs const extractTime = (timeString) => { if (!timeString) return ''; // If it's ISO timestamp like "1970-01-01T08:00:00.000Z" if (timeString.includes('T')) { - const date = new Date(timeString); - const hours = String(date.getUTCHours()).padStart(2, '0'); - const minutes = String(date.getUTCMinutes()).padStart(2, '0'); - return `${hours}:${minutes}`; + return dayjs.utc(timeString).format('HH:mm'); } // If it's already in HH:mm:ss format, remove seconds