From 4a7456508346664347ffa64629eaf8bd4d2f84c3 Mon Sep 17 00:00:00 2001 From: "vluk@2fi-solutions.com.hk" Date: Fri, 22 May 2026 01:39:39 +0800 Subject: [PATCH] no message --- src/components/Jodetail/PlasticBoxCartonDashboardTab.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/Jodetail/PlasticBoxCartonDashboardTab.tsx b/src/components/Jodetail/PlasticBoxCartonDashboardTab.tsx index e9d9f16..92eef86 100644 --- a/src/components/Jodetail/PlasticBoxCartonDashboardTab.tsx +++ b/src/components/Jodetail/PlasticBoxCartonDashboardTab.tsx @@ -28,6 +28,9 @@ import { } from "@/app/api/jo/actions"; import SafeApexCharts from "@/components/charts/SafeApexCharts"; +/** Day.js has no typed `dayjs.invalid()` factory; Invalid Date parses to an invalid Dayjs instance. */ +const DAYJS_INVALID = dayjs(new Date(Number.NaN)); + type FloorFilter = "all" | "2/F" | "3/F" | "4/F"; type DailySummaryRow = { @@ -51,14 +54,14 @@ const parseRecordDate = (record: CompletedJobOrderPickOrderDashboardRecord): day } const raw = record.completedDate ?? record.planStart; - if (!raw) return dayjs.invalid(); + if (!raw) return DAYJS_INVALID; if (Array.isArray(raw)) { const [year, month, day] = raw; if (year != null && month != null && day != null) { return dayjs(new Date(Number(year), Number(month) - 1, Number(day))); } - return dayjs.invalid(); + return DAYJS_INVALID; } if (typeof raw === "string") {