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

Allow decimal amounts #293

Closed
wants to merge 4 commits into from
Closed

Conversation

Shreyaschorge
Copy link
Contributor

This PR addresses issue #190

@vercel
Copy link

vercel bot commented May 26, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
donate-with-planet ✅ Ready (Inspect) Visit Preview Jun 19, 2022 at 8:40AM (UTC)

@norbertschuler
Copy link
Collaborator

norbertschuler commented May 26, 2022

Entering digits works, e.g. for this conservation project https://donate-with-planet-47idl2tvg-planetapp.vercel.app/?to=proj_NPmia9Vh6Ub91nuw2KmWY9uh - but not with German amounts using a comma (",") as a separater which we never really supported (at once place we just automatically replaced every entered comma (",") with a dot (".")).

Bouquet projects I could not test as the only active ones on staging do not have custom amounts.

@tejassonar
Copy link
Contributor

Maybe we can change the regex for the German language.

@norbertschuler norbertschuler self-requested a review June 11, 2022 10:04
Comment on lines +221 to +227
e.target.value = e.target.value
.replace(/[^0-9^\.]+/g, "")
.replace(".", "$#$")
.replace(/\./g, "")
.replace("$#$", ".")
.replace(/^0+/, "");

Copy link
Collaborator

Choose a reason for hiding this comment

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

So this won't allow to input a "," as used as separater for German values, but afterwards will print the amount, e.g. "5.5." in a localized form e.g. "5,5" for German language. It works and we probably cannot support an input parser for every kind of currency formatting, but I am not sure if everybody will understand this logic.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with @norbertschuler, it might be confusing. If it is not possible to find a solution, we should think about a helper text that explains it to the user.

Copy link
Collaborator

Choose a reason for hiding this comment

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

So close this PR or keep it?

@mariahosfeld
Copy link
Contributor

PR is too old, closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants