From 87cc58be925314bccfdca50be22341cafbf13456 Mon Sep 17 00:00:00 2001 From: BenjaminNH <1249376374@qq.com> Date: Mon, 14 Jul 2025 13:01:24 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E5=86=99=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E7=A9=BA=E9=97=B2=E5=88=A4=E6=96=AD=E9=83=A8=E5=88=86?= =?UTF-8?q?=E4=BD=BF=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=98=8E=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/user/DeviceDetailModal.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 () => {