[PR #3096] [CLOSED] Improve number handling for amount with leading decimal point. #4676

Closed
opened 2026-02-28 20:59:31 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/3096
Author: @wdpk
Created: 7/18/2024
Status: Closed

Base: masterHead: leadingdecimalpoint


📝 Commits (6)

  • fd17e5b update number handling to account for leading decimal point
  • 073c9f4 update the test to ensure that leading decimals are handled correctly
  • 55ff163 remove extra if condition that was logically impossible
  • 707bc9e Create 3096.md
  • d3091fc Merge branch 'master' into leadingdecimalpoint
  • cc4e76c lint update, explicit leading 0 expected

📊 Changes

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

View changed files

📝 packages/loot-core/src/shared/util.test.ts (+5 -0)
📝 packages/loot-core/src/shared/util.ts (+6 -1)
upcoming-release-notes/3096.md (+6 -0)

📄 Description

Fixes #1051


category: Bugfix
authors: [wdpk]

Improve number handling to handle leading decimal places.

Existing behavior: amount = '.47', then m.index ===0 so then the return call calls extractNumbers on amount.
extractNumbers('.47') returns 47.

This PR changes the if statement so if m.index ===0 it adds a leading 0, and then the number is correctly handled from there.


🔄 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/3096 **Author:** [@wdpk](https://github.com/wdpk) **Created:** 7/18/2024 **Status:** ❌ Closed **Base:** `master` ← **Head:** `leadingdecimalpoint` --- ### 📝 Commits (6) - [`fd17e5b`](https://github.com/actualbudget/actual/commit/fd17e5b5a4fe6a4f764763669d9d3d3dc136f52b) update number handling to account for leading decimal point - [`073c9f4`](https://github.com/actualbudget/actual/commit/073c9f4a185832698a64e79a42e543480eac0984) update the test to ensure that leading decimals are handled correctly - [`55ff163`](https://github.com/actualbudget/actual/commit/55ff163b8e4f6040b13ed543274bc2ce90c2b182) remove extra if condition that was logically impossible - [`707bc9e`](https://github.com/actualbudget/actual/commit/707bc9e07f23ced3d01c800de0bf4c363d1ae528) Create 3096.md - [`d3091fc`](https://github.com/actualbudget/actual/commit/d3091fc2deabf6e7fd75f4ef8ee91e6dd7b69ecf) Merge branch 'master' into leadingdecimalpoint - [`cc4e76c`](https://github.com/actualbudget/actual/commit/cc4e76c32b0666072a7dab6a5101c60b992f7dd5) lint update, explicit leading 0 expected ### 📊 Changes **3 files changed** (+17 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/loot-core/src/shared/util.test.ts` (+5 -0) 📝 `packages/loot-core/src/shared/util.ts` (+6 -1) ➕ `upcoming-release-notes/3096.md` (+6 -0) </details> ### 📄 Description Fixes #1051 --- category: Bugfix authors: [wdpk] --- Improve number handling to handle leading decimal places. Existing behavior: `amount = '.47'`, then `m.index ===0` so then the return call calls `extractNumbers` on `amount`. `extractNumbers('.47')` returns `47`. This PR changes the if statement so if `m.index ===0` it adds a leading 0, and then the number is correctly handled from there. --- <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-02-28 20:59:31 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#4676