Skip to content

OBPIH-7573 Format expiration date in inventory item to localized string#5620

Merged
alannadolny merged 2 commits intorelease/0.9.6from
bug/OBPIH-7573
Nov 17, 2025
Merged

OBPIH-7573 Format expiration date in inventory item to localized string#5620
alannadolny merged 2 commits intorelease/0.9.6from
bug/OBPIH-7573

Conversation

@alannadolny
Copy link
Collaborator

No description provided.

@alannadolny alannadolny self-assigned this Nov 13, 2025
Copilot AI review requested due to automatic review settings November 13, 2025 16:52
@github-actions github-actions bot added type: bug Addresses unintended behaviours of the app domain: frontend Changes or discussions relating to the frontend UI labels Nov 13, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR formats expiration dates in inventory items to localized strings during cycle count import operations, ensuring dates are displayed according to the user's locale settings.

  • Adds locale-aware formatting to expiration dates when creating custom items from import
  • Utilizes moment.js with the locale setting to format dates in a consistent, user-friendly format
  • Applies the MMM DD, yyyy format to match other date displays in the application

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 640 to 642
expirationDate: moment(item.expirationDate)
.locale(locale)
.format(DateFormat.MMM_DD_YYYY),
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

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

Missing null/undefined check before calling moment() on item.expirationDate. This can cause issues when expiration dates are null or undefined (as seen in line 266 where expirationDate can be null). Consider adding a conditional check similar to the pattern used in getPayload() (lines 346-351) which uses dateWithoutTimeZone() that handles null values. Example: expirationDate: item.expirationDate ? moment(item.expirationDate).locale(locale).format(DateFormat.MMM_DD_YYYY) : null

Suggested change
expirationDate: moment(item.expirationDate)
.locale(locale)
.format(DateFormat.MMM_DD_YYYY),
expirationDate: item.expirationDate
? moment(item.expirationDate)
.locale(locale)
.format(DateFormat.MMM_DD_YYYY)
: null,

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oh shoot, you are right 😮

@codecov
Copy link

codecov bot commented Nov 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (release/0.9.6@cb115dd). Learn more about missing BASE report.

Additional details and impacted files
@@               Coverage Diff               @@
##             release/0.9.6   #5620   +/-   ##
===============================================
  Coverage                 ?   8.52%           
  Complexity               ?    1127           
===============================================
  Files                    ?     712           
  Lines                    ?   45640           
  Branches                 ?   10913           
===============================================
  Hits                     ?    3890           
  Misses                   ?   41171           
  Partials                 ?     579           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

expirationDate: item.expirationDate
? moment(item.expirationDate)
.locale(locale)
.format(DateFormat.MMM_DD_YYYY)
Copy link
Collaborator

Choose a reason for hiding this comment

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

won't this format cause any issues when saving an item? Are they mapped further?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yup

@alannadolny alannadolny changed the base branch from develop to release/0.9.6 November 17, 2025 09:54
@alannadolny alannadolny merged commit b34d3bb into release/0.9.6 Nov 17, 2025
7 checks passed
@alannadolny alannadolny deleted the bug/OBPIH-7573 branch November 17, 2025 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: frontend Changes or discussions relating to the frontend UI type: bug Addresses unintended behaviours of the app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants