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

comma_seperator.2 problem #601

Closed
hunterTR opened this issue Oct 15, 2019 · 13 comments
Closed

comma_seperator.2 problem #601

hunterTR opened this issue Oct 15, 2019 · 13 comments

Comments

@hunterTR
Copy link

[x] Bug
ngx-mask v8.0.9
Angular v7.2.0

I am having problem with comma_seperator.2. It doesn't add following 0 to the 1 digit decimal to make it 2 decimal.
Input: 1000.1 it render as 1,000.1
It doesn't render as 1,000.10

thanks.

@ColinMorris83
Copy link
Contributor

Are you expecting the value you see in the form field to contain the zero on the end? Currently that will just display as .1 but the actual model value that Angular has will contain .10
Note that with latest version the mask has changed to mask="separator.2" and to use a comma you would also pass another attribute thousandSeparator=","

@hunterTR
Copy link
Author

hunterTR commented Oct 15, 2019

What I want to see is 1000.10 on when I patch my form control with a number value 1000.1
thanks.

@lramondev
Copy link

What I want to see is 1000.10 on when I patch my form control with a number value 1000.1
thanks.

if separator.2 is assigned this would be the correct

@hunterTR
Copy link
Author

hunterTR commented Nov 7, 2019

No it doesn't show the extra 0 at the end, if I patch the control with 10.1
separator.2 should add extra one 0 at the end and make it 10.10 in my opinion to make it consistent.
For example my forms showing 10.15 in one place and 10.1 in other place. It is not consistent.

@lramondev
Copy link

lramondev commented Nov 8, 2019

Yes. Just like in PHP and

number_format(10.1, 2) // 10.10
number_format(10.1, 2, ',') // 10,10
number_format(1000.1, 2, ',', '.') // 1.000,10

@dimmal
Copy link

dimmal commented Dec 12, 2019

I can also confirm the issue with trailing zeros.

Example: Input with mask="separator.2" thousandSepartor="," and a value of 18500.1
Expected value: 18,500.10
Current Value: 18,500.1

The control is part of a reactive form.

Can you please elaborate on the usage of the snippet below?

Yes. Just like in PHP and

number_format(10.1, 2) // 10.10

@alex87
Copy link

alex87 commented Feb 18, 2021

We are also facing this issue, has anyone found a workaround?

@lramondev
Copy link

I was forced to go to another library
ngx-currency

@jebner
Copy link

jebner commented Apr 19, 2021

We are also facing this issue (using version 11.1.5 and using forms).
We've seen that there are 2 closed issues on a similar topic (#267, #307) but we couldn't make it work.

Are there any news on this?

@nagulapallinaveen
Copy link

any update on this? we are also facing the same issue

@Qiric
Copy link

Qiric commented Nov 28, 2022

Any update on this?

andriikamaldinov1 added a commit that referenced this issue Jun 8, 2023
andriikamaldinov1 added a commit that referenced this issue Jun 8, 2023
andriikamaldinov1 added a commit that referenced this issue Jun 8, 2023
andriikamaldinov1 added a commit that referenced this issue Jun 8, 2023
andriikamaldinov1 added a commit that referenced this issue Jun 8, 2023
andriikamaldinov1 added a commit that referenced this issue Jun 8, 2023
andriikamaldinov1 added a commit that referenced this issue Jun 8, 2023
andriikamaldinov1 added a commit that referenced this issue Jun 8, 2023
andriikamaldinov1 added a commit that referenced this issue Jun 8, 2023
NepipenkoIgor pushed a commit that referenced this issue Jun 8, 2023
* fix(#601): fix 601

* fix(#601): fix 601

* fix(#601): fix 601

* fix(#601): fix 601

* fix(#601): fix 601

* fix(#601): fix 601

* fix(#1071): fix 1071

* fix(#601): fix 601

* fix(#601): fix 601

* fix(#601): fix 601
andriikamaldinov1 added a commit that referenced this issue Jun 8, 2023
andriikamaldinov1 added a commit that referenced this issue Jun 8, 2023
@andriikamaldinov1
Copy link
Collaborator

@hunterTR @ColinMorris83 @bgl3317 @nagulapallinaveen @lramondev
Thanks for your using Ngx-Mask. Please update to latest version.
It example, all work as expected - https://stackblitz.com/edit/angular-xn8sjm?file=src%2Fmain.ts
We add leadZero to lead zeros to end of the model

@lucasousi
Copy link

@andriikamaldinov1 Is there any way to keep the decimal places inside the input to display it to the user?

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

No branches or pull requests