diff --git a/src/pages/user/DeviceDetailModal.jsx b/src/pages/user/DeviceDetailModal.jsx index e03a20a..36b947a 100644 --- a/src/pages/user/DeviceDetailModal.jsx +++ b/src/pages/user/DeviceDetailModal.jsx @@ -64,16 +64,16 @@ export default function DeviceDetailModal({ visiable, device, onclose }) { if (!current) return false; const today = dayjs().startOf("day"); const currentDay = current.startOf("day"); - if (currentDay.isBefore(today)) { - return true; - } + const isPastDate = current.isBefore(today); + dayjs.extend(isBetween); - return unavailableTimes.some(({ startTime, endTime }) => { + const isUnavailable = unavailableTimes.some(({ startTime, endTime }) => { const start = dayjs(startTime).startOf("day"); const end = dayjs(endTime).endOf("day"); return currentDay.isBetween(start, end, null, "[]"); }); + return isPastDate || isUnavailable; }; const handleOK = async () => {