Skip to content

ENG-613 Add expiry date to supply delivery table#16479

Open
Copilot wants to merge 6 commits into
developfrom
copilot/eng-613-add-expiry-date
Open

ENG-613 Add expiry date to supply delivery table#16479
Copilot wants to merge 6 commits into
developfrom
copilot/eng-613-add-expiry-date

Conversation

Copilot AI commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

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.

  • ENG-613
  • Add an expiry column to the shared supply delivery table.
  • Render the saved product expiry date from supplied_inventory_item in delivery rows.
  • Preserve the existing "-" fallback when no saved expiry is available.

Tagging: @ohcnetwork/care-fe-code-reviewers

Merge Checklist

  • Add specs that demonstrate the bug or test the new feature.
  • Update product documentation.
  • Ensure that UI text is placed in I18n files.
  • Prepare a screenshot or demo video for the changelog entry and attach it to the issue.
  • Request peer reviews.
  • Complete QA on mobile devices.
  • Complete QA on desktop devices.
  • Add or update Playwright tests for related changes
Original prompt

Issue: ENG-613
Summary: Add expiry date to purchase delivery table
Description: Currently expiry date is only shown in the form, and not in the table (saved items). Ensure that PD table has expiry date.

Custom Fields:
Development: {}
Rank: 0|i00c15:

You have been assigned to a work item "Add expiry date to purchase delivery table". Analyze the details of the work item and get started.
Summary: Add expiry date to purchase delivery table
Description: Currently expiry date is only shown in the form, and not in the table (saved items). Ensure that PD table has expiry date.

User: You have been assigned to a work item "Add expiry date to purchase delivery table". Analyze the details of the work item and get started.

Agent: I received your request and will let you know when the PR is ready.

Agent: checking if I have everything I need to get started.

User: ohcnetwork/care_fe

Agent: 📋 I wasn't able to determine which GitHub repository to work in.

Please tell me which repository this work should be done in using the format owner/repository-name (e.g., github/copilot), then I'll automatically start working on it!

Agent: I received your request and will let you know when the PR is ready.

Agent: checking if I have everything I need to get started.

User: skip

Branch naming

This task relates to issue ENG-613 — preserve that identifier somewhere in the branch name and pull request title for traceability. Do not treat the identifier as a verbatim slug or prepend it with a hyphen by default; instead, adapt the full branch name to comply with the repository's branch-naming pattern, adding any required prefix or restructuring the shape as needed.

Include a link to the original issue in the pull request description: https://openhealthcarenetwork.atlassian.net/browse/ENG-613

Copilot AI requested review from Copilot and removed request for Copilot June 25, 2026 06:16
@netlify

netlify Bot commented Jun 25, 2026

Copy link
Copy Markdown

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit f6e8cbd
🔍 Latest deploy log https://app.netlify.com/projects/care-ohc/deploys/6a3d19ca4b57d20008415715
😎 Deploy Preview https://deploy-preview-16479.preview.ohc.network
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Co-authored-by: Jacobjeevan <40040905+Jacobjeevan@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot June 25, 2026 06:25
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 25, 2026

Copy link
Copy Markdown

Deploying care-preview with  Cloudflare Pages  Cloudflare Pages

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

View logs

Co-authored-by: Jacobjeevan <40040905+Jacobjeevan@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot June 25, 2026 06:28
Co-authored-by: Jacobjeevan <40040905+Jacobjeevan@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot June 25, 2026 06:31
Copilot AI changed the title [WIP] Add expiry date to purchase delivery table ENG-613 Add expiry date to purchase delivery table Jun 25, 2026
Copilot AI requested a review from Jacobjeevan June 25, 2026 06:31
Comment thread src/pages/Facility/services/inventory/SupplyDeliveryTable.tsx Outdated
Comment thread src/pages/Facility/services/inventory/SupplyDeliveryTable.tsx Outdated
Comment thread src/pages/Facility/services/inventory/SupplyDeliveryTable.tsx Outdated
Co-authored-by: Jacobjeevan <40040905+Jacobjeevan@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot June 25, 2026 09:38
Copilot AI requested a review from Jacobjeevan June 25, 2026 09:41
Co-authored-by: Jacobjeevan <40040905+Jacobjeevan@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 25, 2026 12:06
Copilot AI removed the request for review from Copilot June 25, 2026 12:06
Copilot AI changed the title ENG-613 Add expiry date to purchase delivery table ENG-613 Add expiry date to supply delivery table Jun 25, 2026
@Jacobjeevan Jacobjeevan marked this pull request as ready for review June 25, 2026 16:15
@Jacobjeevan Jacobjeevan requested review from a team and Copilot June 25, 2026 16:15
@greptile-apps

greptile-apps Bot commented Jun 25, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds an "Expiry" column to SupplyDeliveryTable so that saved delivery rows surface the product's expiry date alongside the existing batch/lot number. The i18n key expiry is already defined in the locale files and the new column is correctly placed in both the header and body rows.

  • A formatExpiryDate helper is introduced that reads supplied_inventory_item?.product?.expiration_date and falls back to \"-\" when the value is absent — matching the pattern used by the adjacent batch column.
  • The helper wraps the date string in new Date() before passing it to formatDate, unlike InventoryList.tsx and StockLotSelector.tsx which pass the string directly; for date-only strings this can display one day early in negative UTC-offset timezones.

Confidence Score: 4/5

Safe 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

Filename Overview
src/pages/Facility/services/inventory/SupplyDeliveryTable.tsx Adds an "Expiry" column to the supply delivery table by reading supplied_inventory_item.product.expiration_date; the i18n key exists and column placement is correct, but the date formatter wraps the date-only string in new Date() which can produce an off-by-one date in negative UTC-offset timezones.

Reviews (1): Last reviewed commit: "fix: always show delivery expiry" | Re-trigger Greptile

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

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") : "-";
};

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 expiry column in the SupplyDeliveryTable header.
  • Renders supplied_inventory_item.product.expiration_date for each delivery row with a "-" fallback.

Comment on lines +168 to +170
const formatExpiryDate = (expiryDate?: string) => {
return expiryDate ? formatDate(new Date(expiryDate), "dd/MM/yyyy") : "-";
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants