Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/pages/Facility/services/inventory/SupplyDeliveryTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@
return map;
}, [deliveries]);

const formatExpiryDate = (expiryDate?: string) => {
return expiryDate ? formatDate(new Date(expiryDate), "dd/MM/yyyy") : "-";
};
Comment on lines +168 to +170

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Wrapping a date-only string like "2026-06-15" in new Date() causes the browser to interpret it as UTC midnight. In negative UTC-offset timezones (e.g. UTC−5) this renders as June 14, not June 15. Other places in the codebase that read product.expiration_dateInventoryList.tsx and StockLotSelector.tsx — pass the string directly to formatDate, which lets date-fns parse it as local time and avoids the off-by-one.

Suggested change
const formatExpiryDate = (expiryDate?: string) => {
return expiryDate ? formatDate(new Date(expiryDate), "dd/MM/yyyy") : "-";
};
const formatExpiryDate = (expiryDate?: string) => {
return expiryDate ? formatDate(expiryDate, "dd/MM/yyyy") : "-";
};

Comment on lines +168 to +170

return (
<Table>
<TableHeader>
Expand All @@ -185,6 +189,7 @@
<TableHead rowSpan={2}>{t("#")}</TableHead>
<TableHead rowSpan={2}>{t("item")}</TableHead>
<TableHead rowSpan={2}>{t("batch")}</TableHead>
<TableHead rowSpan={2}>{t("expiry")}</TableHead>
<TableHead rowSpan={2}>{t("requested_qty")}</TableHead>
{!internal && <TableHead rowSpan={2}>{t("pack_size")}</TableHead>}
{!internal && <TableHead rowSpan={2}>{t("pack_qty")}</TableHead>}
Expand Down Expand Up @@ -278,8 +283,12 @@
})()}
</TableCell>
<TableCell>
{delivery.supplied_inventory_item?.product?.batch?.lot_number ||
"-"}
{delivery.supplied_inventory_item?.product?.batch?.lot_number || "-"}

Check failure on line 286 in src/pages/Facility/services/inventory/SupplyDeliveryTable.tsx

View workflow job for this annotation

GitHub Actions / lint

Insert `⏎···············`
</TableCell>
<TableCell>
{formatExpiryDate(
delivery.supplied_inventory_item?.product?.expiration_date,
)}
</TableCell>
<TableCell>
{delivery.supply_request
Expand Down
Loading