ENG-613 Add expiry date to supply delivery table#16479
Conversation
✅ Deploy Preview for care-ohc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Co-authored-by: Jacobjeevan <40040905+Jacobjeevan@users.noreply.github.com>
Deploying care-preview with
|
| Latest commit: |
f6e8cbd
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://5b137679.care-preview-a7w.pages.dev |
| Branch Preview URL: | https://copilot-eng-613-add-expiry-d.care-preview-a7w.pages.dev |
Co-authored-by: Jacobjeevan <40040905+Jacobjeevan@users.noreply.github.com>
Co-authored-by: Jacobjeevan <40040905+Jacobjeevan@users.noreply.github.com>
Co-authored-by: Jacobjeevan <40040905+Jacobjeevan@users.noreply.github.com>
Co-authored-by: Jacobjeevan <40040905+Jacobjeevan@users.noreply.github.com>
Greptile SummaryThis PR adds an "Expiry" column to
Confidence Score: 4/5Safe to merge with a minor date-display inconsistency that only affects users in negative UTC-offset timezones. The change is small and targeted — one new column, one helper function. The column header, i18n key, and null-safety chaining are all correct. The only concern is that the helper constructs a Date object from a date-only string before formatting, which other parts of the codebase avoid precisely because it can shift the displayed date by one day in certain timezones. src/pages/Facility/services/inventory/SupplyDeliveryTable.tsx — the formatExpiryDate helper's date parsing approach. Important Files Changed
Reviews (1): Last reviewed commit: "fix: always show delivery expiry" | Re-trigger Greptile |
| const formatExpiryDate = (expiryDate?: string) => { | ||
| return expiryDate ? formatDate(new Date(expiryDate), "dd/MM/yyyy") : "-"; | ||
| }; |
There was a problem hiding this comment.
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_date — InventoryList.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.
| const formatExpiryDate = (expiryDate?: string) => { | |
| return expiryDate ? formatDate(new Date(expiryDate), "dd/MM/yyyy") : "-"; | |
| }; | |
| const formatExpiryDate = (expiryDate?: string) => { | |
| return expiryDate ? formatDate(expiryDate, "dd/MM/yyyy") : "-"; | |
| }; |
There was a problem hiding this comment.
Pull request overview
Adds visibility of product expiry dates in the shared supply delivery table so users can see persisted expiry information alongside batch details.
Changes:
- Introduces an
expirycolumn in theSupplyDeliveryTableheader. - Renders
supplied_inventory_item.product.expiration_datefor each delivery row with a"-"fallback.
| const formatExpiryDate = (expiryDate?: string) => { | ||
| return expiryDate ? formatDate(new Date(expiryDate), "dd/MM/yyyy") : "-"; | ||
| }; |
Proposed Changes
Supply delivery rows already captured expiry in the form, but the saved items table did not surface it. This updates the shared delivery table so persisted delivery rows show expiry alongside batch details.
expirycolumn to the shared supply delivery table.supplied_inventory_itemin delivery rows."-"fallback when no saved expiry is available.Tagging: @ohcnetwork/care-fe-code-reviewers
Merge Checklist
Original prompt