[PR #94] [MERGED] currency-formatter -> Intl.NumberFormat #56667

Closed
opened 2026-05-06 20:29:01 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/94
Author: @trevdor
Created: 6/17/2022
Status: Merged
Merged: 7/20/2022
Merged by: @jlongster

Base: masterHead: currencyFormat


📝 Commits (2)

  • 6d8307c refactor: currency-formatter -> Intl.NumberFormat
  • 4c56191 build: Bump @babel/plugin-transform-modules-commonjs to get test transform working

📊 Changes

7 files changed (+136 additions, -38 deletions)

View changed files

📝 package.json (+1 -1)
📝 packages/loot-core/package.json (+0 -1)
📝 packages/loot-core/src/shared/util.js (+6 -14)
📝 packages/loot-core/src/shared/util.test.js (+23 -1)
📝 packages/loot-design/src/components/modals/SelectLinkedAccounts.js (+0 -1)
📝 packages/mobile/package.json (+0 -1)
📝 yarn.lock (+106 -19)

📄 Description

Closes #90

Deps Changes

  1. The babel transform to CommonJS for Jest (as I understand it) was failing. Seemed to be due to shifting deps versions, and bumping @babel/plugin-transform-modules-commonjs addressed it.
  2. And of course, removed currency-formatter

Locale Change

Switch to en-ZA as our example locale for space-comma.
(za-ZA does not exist. Might have been a typo for zu-ZA, but that is a comma-dot locale, to use Actual notation.)

Open Questions

Is this the best way to fix to 2 decimal places?

  • Usually, the currency param to NumberFormat would dictate the minimumFractionDigits/maximumFractionDigits values, but we're avoiding setting a specific currency (along with the currency symbol that brings).
  • As far as I understand, nearly every currency worldwide (though not 100% of them) uses 2 fractional digits. I'd argue it's safe to fix to 2 at least for our purposes, but open to being convinced otherwise.

Show 'n' Tell

Before (currency-formatter) --> After (Intl.NumberFormat as configured in this PR)
currency-formatter Int NumberFormat


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/94 **Author:** [@trevdor](https://github.com/trevdor) **Created:** 6/17/2022 **Status:** ✅ Merged **Merged:** 7/20/2022 **Merged by:** [@jlongster](https://github.com/jlongster) **Base:** `master` ← **Head:** `currencyFormat` --- ### 📝 Commits (2) - [`6d8307c`](https://github.com/actualbudget/actual/commit/6d8307c3ee3153162c79aabdf0f322477b568e3f) refactor: currency-formatter -> Intl.NumberFormat - [`4c56191`](https://github.com/actualbudget/actual/commit/4c56191e71a8fa18d2c639e1a57e87e6bec0c747) build: Bump @babel/plugin-transform-modules-commonjs to get test transform working ### 📊 Changes **7 files changed** (+136 additions, -38 deletions) <details> <summary>View changed files</summary> 📝 `package.json` (+1 -1) 📝 `packages/loot-core/package.json` (+0 -1) 📝 `packages/loot-core/src/shared/util.js` (+6 -14) 📝 `packages/loot-core/src/shared/util.test.js` (+23 -1) 📝 `packages/loot-design/src/components/modals/SelectLinkedAccounts.js` (+0 -1) 📝 `packages/mobile/package.json` (+0 -1) 📝 `yarn.lock` (+106 -19) </details> ### 📄 Description Closes #90 ### Deps Changes 1. The babel transform to CommonJS for Jest (as I understand it) was failing. Seemed to be due to shifting deps versions, and bumping `@babel/plugin-transform-modules-commonjs` addressed it. 2. And of course, removed `currency-formatter` ### Locale Change Switch to `en-ZA` as our example locale for `space-comma`. (`za-ZA` does not exist. Might have been a typo for `zu-ZA`, but that is a `comma-dot` locale, to use Actual notation.) ### Open Questions Is [this the best way](https://github.com/actualbudget/actual/pull/94/files#diff-6f58f196a7aadd917737fb14e3a029efc67613f24c081bfed8d4c6433c6b308fR288-R289) to fix to 2 decimal places? * Usually, the `currency` param to `NumberFormat` would dictate the `minimumFractionDigits`/`maximumFractionDigits` values, but we're avoiding setting a specific currency (along with the currency symbol that brings). * As far as I understand, nearly every currency worldwide (though not 100% of them) uses 2 fractional digits. I'd argue it's safe to fix to 2 at least for our purposes, but open to being convinced otherwise. ### Show 'n' Tell Before (`currency-formatter`) --> After (`Intl.NumberFormat` as configured in this PR) <img width="215" alt="currency-formatter" src="https://user-images.githubusercontent.com/5862724/174337633-0c2a47c9-eaa0-47f3-a543-0231e60645f9.png"> <img width="215" alt="Int NumberFormat" src="https://user-images.githubusercontent.com/5862724/174337753-488d0fb0-4be0-4faa-b64e-a9a3afefb5f3.png"> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-06 20:29:01 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#56667