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

Amount formatting issue #693

Closed
ravinderk opened this issue Jul 7, 2016 · 2 comments
Closed

Amount formatting issue #693

ravinderk opened this issue Jul 7, 2016 · 2 comments
Assignees
Milestone

Comments

@ravinderk
Copy link
Collaborator

When thousand and decimal separator set to comma and dot then give_sanitize_amount works fine but if we change decimal separator to comma ( same as thousand separator ) then we will get worng goal amount. Since we give option to user to set custom separator then we have to handle this issue.

screen shot 2016-07-07 at 11 59 48 am

screen shot 2016-07-07 at 11 59 20 am

screen shot 2016-07-07 at 11 59 33 am

I have few questions:

  1. Do we need to store formatted goal amount. Cann't we store this without formatted digit as we are doing for form earnings

screen shot 2016-07-07 at 12 06 53 pm

1. Current `give_sanitize_amount` function only format amount on basis on current separator's value. Are we handling user case when user will change separator value after some time?
@ravinderk
Copy link
Collaborator Author

@DevinWalker I researched about amount formatting issue. and I found that we should not use amount formatting in input fields ( goal and price both ), because we have to remove number formatting from amount whenever we will save them to database. In my opinion number formatting should be one way means whenever we need to display or for any other reason need formatting amount we can calculate it from decimal formatted amount ( we should use dot for decimal when storing value to database ), So we do not need to sanitize formatted amount.

screen shot 2016-07-08 at 6 23 40 pm

screen shot 2016-07-08 at 6 23 45 pm

screen shot 2016-07-08 at 6 27 10 pm

Woocommerce is following same strategy when showing pre filled price or saving price to database

screen shot 2016-07-08 at 6 39 39 pm

@DevinWalker
Copy link
Member

Related to #696

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

No branches or pull requests

2 participants