Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Make comma's and period interchangeable when entering figures #2672

Merged
merged 1 commit into from May 16, 2024

Conversation

Wizmaster
Copy link
Contributor

Implements #2318

It's only allowed for formats not using period or comma as a thousand separator. I don't think somebody using a format with comma and dot as decimal and thousand separator would have the issue in the first place.

I reworked the arithmetic parser to let currencyToAmount() handle number formatting with active format. I noticed it also made an exception for a leading currency symbol but not for a tailing one. I fixed it to allow that case. (actually in my implementation you could also put a currency symbol in the middle of a value but it would be ignored anyway, I don't think it's an issue)

@trafico-bot trafico-bot bot added the 🔍 Ready for Review Pull Request is not reviewed yet label Apr 26, 2024
@github-actions github-actions bot changed the title [Feature] Make comma's and period interchangeable when entering figures [WIP] [Feature] Make comma's and period interchangeable when entering figures Apr 26, 2024
Copy link

netlify bot commented Apr 26, 2024

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit b90402c
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/6643ba3aa0c6ba0008c163ec
😎 Deploy Preview https://deploy-preview-2672.demo.actualbudget.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@trafico-bot trafico-bot bot added 🚧 WIP Still work-in-progress, please don't review and don't merge and removed 🔍 Ready for Review Pull Request is not reviewed yet labels Apr 26, 2024
Copy link
Contributor

github-actions bot commented Apr 26, 2024

Bundle Stats — desktop-client

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
9 4.72 MB → 4.72 MB (+44 B) +0.00%
Changeset
File Δ Size
home/runner/work/actual/actual/packages/loot-core/src/shared/util.ts 📈 +283 B (+4.55%) 6.07 kB → 6.35 kB
home/runner/work/actual/actual/packages/loot-core/src/shared/arithmetic.ts 📉 -239 B (-8.98%) 2.6 kB → 2.36 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
static/js/index.js 3 MB → 3 MB (+44 B) +0.00%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
static/js/indexeddb-main-thread-worker-e59fee74.js 13.5 kB 0%
static/js/resize-observer.js 18.37 kB 0%
static/js/BackgroundImage.js 122.29 kB 0%
static/js/narrow.js 59.81 kB 0%
static/js/usePreviewTransactions.js 790 B 0%
static/js/AppliedFilters.js 20.54 kB 0%
static/js/wide.js 262.4 kB 0%
static/js/ReportRouter.js 1.23 MB 0%

Copy link
Contributor

github-actions bot commented Apr 26, 2024

Bundle Stats — loot-core

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
1 1.2 MB → 1.2 MB (+142 B) +0.01%
Changeset
File Δ Size
packages/loot-core/src/shared/util.ts 📈 +313 B (+3.07%) 9.97 kB → 10.28 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
kcab.worker.js 1.2 MB → 1.2 MB (+142 B) +0.01%

Smaller

No assets were smaller

Unchanged

No assets were unchanged

@Wizmaster Wizmaster changed the title [WIP] [Feature] Make comma's and period interchangeable when entering figures [Feature] Make comma's and period interchangeable when entering figures Apr 26, 2024
@trafico-bot trafico-bot bot added 🔍 Ready for Review Pull Request is not reviewed yet and removed 🚧 WIP Still work-in-progress, please don't review and don't merge labels Apr 26, 2024
@joel-jeremy
Copy link
Contributor

@Wizmaster Can you provide some steps to test these changes out?

@Wizmaster
Copy link
Contributor Author

@joel-jeremy You can use the test budget with the number formatting "1 000,33" (or "1 000.33").

The PR allow then to input amounts with "10.50" or "10,50" in transactions or budget values. It also allow to use arithmetic like "$10.50+$10.25" or "26€-5,25€" with the correct result (20.75 both).

joel-jeremy
joel-jeremy previously approved these changes May 13, 2024
Copy link
Contributor

@joel-jeremy joel-jeremy left a comment

Choose a reason for hiding this comment

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

LGTM!

@trafico-bot trafico-bot bot added the ✅ Approved Pull Request has been approved and can be merged label May 13, 2024
@@ -237,13 +237,14 @@ export function getNumberFormat({
format?: NumberFormats;
hideFraction: boolean;
} = numberFormatConfig) {
let locale, regex, separator;
let locale, regex, separator, regexSeparator;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit:

Suggested change
let locale, regex, separator, regexSeparator;
let locale, regex, separator, separatorRegex;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@joel-jeremy Done, I renamed the variable.

- Only allowed for formats not using period or comma as a thousand separator
@trafico-bot trafico-bot bot removed the ✅ Approved Pull Request has been approved and can be merged label May 14, 2024
@trafico-bot trafico-bot bot added ✅ Approved Pull Request has been approved and can be merged and removed 🔍 Ready for Review Pull Request is not reviewed yet labels May 16, 2024
@joel-jeremy joel-jeremy merged commit 5a77051 into actualbudget:master May 16, 2024
19 checks passed
@trafico-bot trafico-bot bot added ✨ Merged Pull Request has been merged successfully and removed ✅ Approved Pull Request has been approved and can be merged labels May 16, 2024
@Wizmaster Wizmaster deleted the feature/merge-comma-dot branch May 17, 2024 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Merged Pull Request has been merged successfully
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants