Bladeren bron

no message

production
[email protected] 1 maand geleden
bovenliggende
commit
4a74565083
1 gewijzigde bestanden met toevoegingen van 5 en 2 verwijderingen
  1. +5
    -2
      src/components/Jodetail/PlasticBoxCartonDashboardTab.tsx

+ 5
- 2
src/components/Jodetail/PlasticBoxCartonDashboardTab.tsx Bestand weergeven

@@ -28,6 +28,9 @@ import {
} from "@/app/api/jo/actions"; } from "@/app/api/jo/actions";
import SafeApexCharts from "@/components/charts/SafeApexCharts"; 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 FloorFilter = "all" | "2/F" | "3/F" | "4/F";


type DailySummaryRow = { type DailySummaryRow = {
@@ -51,14 +54,14 @@ const parseRecordDate = (record: CompletedJobOrderPickOrderDashboardRecord): day
} }


const raw = record.completedDate ?? record.planStart; const raw = record.completedDate ?? record.planStart;
if (!raw) return dayjs.invalid();
if (!raw) return DAYJS_INVALID;


if (Array.isArray(raw)) { if (Array.isArray(raw)) {
const [year, month, day] = raw; const [year, month, day] = raw;
if (year != null && month != null && day != null) { if (year != null && month != null && day != null) {
return dayjs(new Date(Number(year), Number(month) - 1, Number(day))); return dayjs(new Date(Number(year), Number(month) - 1, Number(day)));
} }
return dayjs.invalid();
return DAYJS_INVALID;
} }


if (typeof raw === "string") { if (typeof raw === "string") {


Laden…
Annuleren
Opslaan