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
[Feature] Make comma's and period interchangeable when entering figures #2672
Conversation
✅ Deploy Preview for actualbudget ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Bundle Stats — desktop-clientHey 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
Changeset
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger
Smaller No assets were smaller Unchanged
|
Bundle Stats — loot-coreHey 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
Changeset
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger
Smaller No assets were smaller Unchanged No assets were unchanged |
f853ba0
to
8a67670
Compare
8a67670
to
b0caae0
Compare
@Wizmaster Can you provide some steps to test these changes out? |
@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). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -237,13 +237,14 @@ export function getNumberFormat({ | |||
format?: NumberFormats; | |||
hideFraction: boolean; | |||
} = numberFormatConfig) { | |||
let locale, regex, separator; | |||
let locale, regex, separator, regexSeparator; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit:
let locale, regex, separator, regexSeparator; | |
let locale, regex, separator, separatorRegex; |
There was a problem hiding this comment.
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
b0caae0
to
b90402c
Compare
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)