Skip to content

fix(dashboard): fix currency input locale formatting - #12812

Merged
olivermrbl merged 4 commits into
developfrom
fix/currency-input-formatting
Jun 25, 2025
Merged

fix(dashboard): fix currency input locale formatting#12812
olivermrbl merged 4 commits into
developfrom
fix/currency-input-formatting

Conversation

@fPolic

@fPolic fPolic commented Jun 24, 2025

Copy link
Copy Markdown
Contributor

What

  • fix float parsing for currency inputs that have float values (when the value is formatted with comma as decimal separator)
  • cleanup and fix refund forms
  • update currency input forms in RMA flows

FIXES SUP-1914

@fPolic
fPolic requested a review from a team as a code owner June 24, 2025 13:03
@changeset-bot

changeset-bot Bot commented Jun 24, 2025

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 37ad8bc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel

vercel Bot commented Jun 24, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference 🔄 Building (Inspect) Visit Preview 💬 Add feedback Jun 24, 2025 1:15pm
medusa-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 24, 2025 1:15pm
7 Skipped Deployments
Name Status Preview Comments Updated (UTC)
api-reference-v2 ⬜️ Ignored (Inspect) Visit Preview Jun 24, 2025 1:15pm
cloud-docs ⬜️ Ignored (Inspect) Visit Preview Jun 24, 2025 1:15pm
docs-ui ⬜️ Ignored (Inspect) Visit Preview Jun 24, 2025 1:15pm
docs-v2 ⬜️ Ignored (Inspect) Visit Preview Jun 24, 2025 1:15pm
medusa-docs ⬜️ Ignored (Inspect) Visit Preview Jun 24, 2025 1:15pm
resources-docs ⬜️ Ignored (Inspect) Visit Preview Jun 24, 2025 1:15pm
user-guide ⬜️ Ignored (Inspect) Visit Preview Jun 24, 2025 1:15pm

@olivermrbl

Copy link
Copy Markdown
Contributor

/snapshot-this

@github-actions

Copy link
Copy Markdown
Contributor

🚀 A snapshot release has been made for this PR

Test the snapshots by updating your package.json with the newly published versions:

yarn add @medusajs/admin-bundler@2.8.5-snapshot-20250624163405
yarn add @medusajs/admin-sdk@2.8.5-snapshot-20250624163405
yarn add @medusajs/admin-shared@2.8.5-snapshot-20250624163405
yarn add @medusajs/admin-vite-plugin@2.8.5-snapshot-20250624163405
yarn add @medusajs/dashboard@2.8.5-snapshot-20250624163405
yarn add create-medusa-app@2.8.5-snapshot-20250624163405
yarn add @medusajs/cli@2.8.5-snapshot-20250624163405
yarn add medusa-dev-cli@2.8.5-snapshot-20250624163405
yarn add @medusajs/medusa-oas-cli@2.8.5-snapshot-20250624163405
yarn add @medusajs/core-flows@2.8.5-snapshot-20250624163405
yarn add @medusajs/framework@2.8.5-snapshot-20250624163405
yarn add @medusajs/js-sdk@2.8.5-snapshot-20250624163405
yarn add @medusajs/modules-sdk@2.8.5-snapshot-20250624163405
yarn add @medusajs/orchestration@2.8.5-snapshot-20250624163405
yarn add @medusajs/types@2.8.5-snapshot-20250624163405
yarn add @medusajs/utils@2.8.5-snapshot-20250624163405
yarn add @medusajs/workflows-sdk@2.8.5-snapshot-20250624163405
yarn add @medusajs/icons@2.8.5-snapshot-20250624163405
yarn add @medusajs/ui@4.0.15-snapshot-20250624163405
yarn add @medusajs/ui-preset@2.8.5-snapshot-20250624163405
yarn add @medusajs/medusa@2.8.5-snapshot-20250624163405
yarn add @medusajs/telemetry@2.8.5-snapshot-20250624163405
yarn add @medusajs/test-utils@2.8.5-snapshot-20250624163405
yarn add @medusajs/analytics@2.8.5-snapshot-20250624163405
yarn add @medusajs/api-key@2.8.5-snapshot-20250624163405
yarn add @medusajs/auth@2.8.5-snapshot-20250624163405
yarn add @medusajs/cache-inmemory@2.8.5-snapshot-20250624163405
yarn add @medusajs/cache-redis@2.8.5-snapshot-20250624163405
yarn add @medusajs/cart@2.8.5-snapshot-20250624163405
yarn add @medusajs/currency@2.8.5-snapshot-20250624163405
yarn add @medusajs/customer@2.8.5-snapshot-20250624163405
yarn add @medusajs/event-bus-local@2.8.5-snapshot-20250624163405
yarn add @medusajs/event-bus-redis@2.8.5-snapshot-20250624163405
yarn add @medusajs/file@2.8.5-snapshot-20250624163405
yarn add @medusajs/fulfillment@2.8.5-snapshot-20250624163405
yarn add @medusajs/index@2.8.5-snapshot-20250624163405
yarn add @medusajs/inventory@2.8.5-snapshot-20250624163405
yarn add @medusajs/link-modules@2.8.5-snapshot-20250624163405
yarn add @medusajs/locking@2.8.5-snapshot-20250624163405
yarn add @medusajs/notification@2.8.5-snapshot-20250624163405
yarn add @medusajs/order@2.8.5-snapshot-20250624163405
yarn add @medusajs/payment@2.8.5-snapshot-20250624163405
yarn add @medusajs/pricing@2.8.5-snapshot-20250624163405
yarn add @medusajs/product@2.8.5-snapshot-20250624163405
yarn add @medusajs/promotion@2.8.5-snapshot-20250624163405
yarn add @medusajs/analytics-local@2.8.5-snapshot-20250624163405
yarn add @medusajs/analytics-posthog@2.8.5-snapshot-20250624163405
yarn add @medusajs/auth-emailpass@2.8.5-snapshot-20250624163405
yarn add @medusajs/auth-github@2.8.5-snapshot-20250624163405
yarn add @medusajs/auth-google@2.8.5-snapshot-20250624163405
yarn add @medusajs/file-local@2.8.5-snapshot-20250624163405
yarn add @medusajs/file-s3@2.8.5-snapshot-20250624163405
yarn add @medusajs/fulfillment-manual@2.8.5-snapshot-20250624163405
yarn add @medusajs/locking-postgres@2.8.5-snapshot-20250624163405
yarn add @medusajs/locking-redis@2.8.5-snapshot-20250624163405
yarn add @medusajs/notification-local@2.8.5-snapshot-20250624163405
yarn add @medusajs/notification-sendgrid@2.8.5-snapshot-20250624163405
yarn add @medusajs/payment-stripe@2.8.5-snapshot-20250624163405
yarn add @medusajs/region@2.8.5-snapshot-20250624163405
yarn add @medusajs/sales-channel@2.8.5-snapshot-20250624163405
yarn add @medusajs/stock-location@2.8.5-snapshot-20250624163405
yarn add @medusajs/store@2.8.5-snapshot-20250624163405
yarn add @medusajs/tax@2.8.5-snapshot-20250624163405
yarn add @medusajs/user@2.8.5-snapshot-20250624163405
yarn add @medusajs/workflow-engine-inmemory@2.8.5-snapshot-20250624163405
yarn add @medusajs/workflow-engine-redis@2.8.5-snapshot-20250624163405

Latest commit: 93cf79c

@olivermrbl olivermrbl linked an issue Jun 24, 2025 that may be closed by this pull request
@@ -1,5 +1,5 @@
export const formatCurrency = (amount: number, currency: string) => {
return new Intl.NumberFormat("en-US", {
return new Intl.NumberFormat(undefined, {

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.

question: Why was this change required?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

With this change, the default runtime locale is used for formatting instead of forcing en-US. This way currency formatting should be the same for the currency input and the places we use this helper (previously for example with DE locale formatting would be 1.234,5 but the helper would return 1,234.5.

@olivermrbl

Copy link
Copy Markdown
Contributor

Just tried the snapshot; I cannot seem to use comma as a separation, e.g. for Danish kroner.

@fPolic

fPolic commented Jun 24, 2025

Copy link
Copy Markdown
Contributor Author

Just tried the snapshot; I cannot seem to use comma as a separation, e.g. for Danish kroner.

What language/locale you have set in the browser? If you change to de-DE for example, you should be able to use a comma as a decimal separator.

@olivermrbl

Copy link
Copy Markdown
Contributor

Just tried the snapshot; I cannot seem to use comma as a separation, e.g. for Danish kroner.

What language/locale you have set in the browser? If you change to de-DE for example, you should be able to use a comma as a decimal separator.

Shouldn't this be automatically detected and set?

@fPolic

fPolic commented Jun 24, 2025

Copy link
Copy Markdown
Contributor Author

Yes, the browser sets the locale depending on OS settings, browser preferences etc. (I suggested changing to German to simulate comma formatting).

If English is detected locale will be set to navigator.language = "en-GB", in that case all currencies on the Admin will be formatted with . as a decimal separator. If German is detected, navigator.language will be de-DE and all currencies on admin will use a comma for decimal separator.

@olivermrbl
olivermrbl merged commit 9d61bb7 into develop Jun 25, 2025
27 checks passed
@olivermrbl
olivermrbl deleted the fix/currency-input-formatting branch June 25, 2025 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Refund amount not parsed properly when value contains comma

2 participants