[PR #6247] [MERGED] fix: Handle unicode minus in number parsing #25019

Closed
opened 2026-04-16 18:21:45 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/6247
Author: @MatissJanis
Created: 11/25/2025
Status: Merged
Merged: 12/4/2025
Merged by: @MatissJanis

Base: masterHead: cursor/fix-actual-github-issue-6206-45c2


📝 Commits (9)

  • 1fa79b4 fix(core): handle unicode minus in number parsing
  • d250e63 Refactor: Improve currency parsing logic
  • ed46c89 Refactor: Simplify currency parsing logic
  • 996d8e5 [autofix.ci] apply automated fixes
  • e20fc38 Merge branch 'master' into cursor/fix-actual-github-issue-6206-45c2
  • c9f126a fix: Handle Unicode minus inside parentheses correctly
  • 04a841b Merge branch 'master' into cursor/fix-actual-github-issue-6206-45c2
  • 8aa9082 Add release notes for PR #6247
  • 2728303 Merge branch 'master' into cursor/fix-actual-github-issue-6206-45c2

📊 Changes

3 files changed (+35 additions, -1 deletions)

View changed files

📝 packages/loot-core/src/shared/util.test.ts (+18 -0)
📝 packages/loot-core/src/shared/util.ts (+10 -1)
upcoming-release-notes/6247.md (+7 -0)

📄 Description

Fixes #6206.

When importing CSV files generated by Numbers on macOS, amounts may contain the Unicode minus sign (U+2212) instead of the ASCII hyphen-minus. This caused parsing to fail (resulting in positive numbers instead of negative).

This PR updates looselyParseAmount, currencyToAmount, and stringToInteger in loot-core/src/shared/util.ts to replace Unicode minus with ASCII minus before parsing.

Added unit tests to cover these cases.


Open in Cursor Open in Web


Note

Normalize U+2212 to '-' in parsing utilities and add tests to ensure negative values are handled correctly.

  • Core utilities:
    • Number parsing: currencyToAmount, stringToInteger, and looselyParseAmount now normalize Unicode minus (\u2212) to ASCII -; parentheses + Unicode minus handled correctly.
  • Tests:
    • Add unit tests covering Unicode minus across parsing scenarios.
  • Release notes:
    • Add upcoming-release-notes/6247.md entry documenting the bugfix.

Written by Cursor Bugbot for commit 2728303adf. This will update automatically on new commits. Configure here.


🔄 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/6247 **Author:** [@MatissJanis](https://github.com/MatissJanis) **Created:** 11/25/2025 **Status:** ✅ Merged **Merged:** 12/4/2025 **Merged by:** [@MatissJanis](https://github.com/MatissJanis) **Base:** `master` ← **Head:** `cursor/fix-actual-github-issue-6206-45c2` --- ### 📝 Commits (9) - [`1fa79b4`](https://github.com/actualbudget/actual/commit/1fa79b472f7c3dc5d910aad477c91ef1fd140466) fix(core): handle unicode minus in number parsing - [`d250e63`](https://github.com/actualbudget/actual/commit/d250e630abd5838d8be13107587a42ee12b9df8f) Refactor: Improve currency parsing logic - [`ed46c89`](https://github.com/actualbudget/actual/commit/ed46c893dde2bffa2b6c18593efae25995336799) Refactor: Simplify currency parsing logic - [`996d8e5`](https://github.com/actualbudget/actual/commit/996d8e576798a3cb6c1dad5e61bd2180be980b17) [autofix.ci] apply automated fixes - [`e20fc38`](https://github.com/actualbudget/actual/commit/e20fc38085e00646e98bfbdbc633bfa97293ea02) Merge branch 'master' into cursor/fix-actual-github-issue-6206-45c2 - [`c9f126a`](https://github.com/actualbudget/actual/commit/c9f126a87df6deac0e40d8b5683093a270ed5f6f) fix: Handle Unicode minus inside parentheses correctly - [`04a841b`](https://github.com/actualbudget/actual/commit/04a841b149c9cddedc22ec115cf92b1edb8e0627) Merge branch 'master' into cursor/fix-actual-github-issue-6206-45c2 - [`8aa9082`](https://github.com/actualbudget/actual/commit/8aa90821b834816ffbc90dc2ca6111a34f746080) Add release notes for PR #6247 - [`2728303`](https://github.com/actualbudget/actual/commit/2728303adf73159488eb984d2f94a849874c9b60) Merge branch 'master' into cursor/fix-actual-github-issue-6206-45c2 ### 📊 Changes **3 files changed** (+35 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/loot-core/src/shared/util.test.ts` (+18 -0) 📝 `packages/loot-core/src/shared/util.ts` (+10 -1) ➕ `upcoming-release-notes/6247.md` (+7 -0) </details> ### 📄 Description Fixes #6206. When importing CSV files generated by Numbers on macOS, amounts may contain the Unicode minus sign (U+2212) instead of the ASCII hyphen-minus. This caused parsing to fail (resulting in positive numbers instead of negative). This PR updates `looselyParseAmount`, `currencyToAmount`, and `stringToInteger` in `loot-core/src/shared/util.ts` to replace Unicode minus with ASCII minus before parsing. Added unit tests to cover these cases. --- <a href="https://cursor.com/background-agent?bcId=bc-9db3987c-5c4f-4548-b865-18ab0b320957"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/open-in-cursor-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/open-in-cursor-light.svg"><img alt="Open in Cursor" src="https://cursor.com/open-in-cursor.svg"></picture></a>&nbsp;<a href="https://cursor.com/agents?id=bc-9db3987c-5c4f-4548-b865-18ab0b320957"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/open-in-web-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/open-in-web-light.svg"><img alt="Open in Web" src="https://cursor.com/open-in-web.svg"></picture></a> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Normalize U+2212 to '-' in parsing utilities and add tests to ensure negative values are handled correctly. > > - **Core utilities**: > - **Number parsing**: `currencyToAmount`, `stringToInteger`, and `looselyParseAmount` now normalize Unicode minus (`\u2212`) to ASCII `-`; parentheses + Unicode minus handled correctly. > - **Tests**: > - Add unit tests covering Unicode minus across parsing scenarios. > - **Release notes**: > - Add `upcoming-release-notes/6247.md` entry documenting the bugfix. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 2728303adf73159488eb984d2f94a849874c9b60. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --- <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-04-16 18:21:45 -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#25019