question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NzInputNumberComponent European number insert

See original GitHub issue

What problem does this feature solve?

In most European countries, a comma is used to separate the integral part of a number from the decimal part. This means, for example, that three hundred euros and ten cents is written as 300,10 - with a comma as a decimal marker.

It’s not possible to insert a number like 10,5 - the value in this case is 105 because the comma is not allowed

What does the proposed API look like?


export class NzInputNumberComponent implements ControlValueAccessor, AfterViewInit, OnChanges, OnInit, OnDestroy {

 onModelChange(value: string): void {
    this.actualValue = this.nzParser(
      value
        .trim()
        .replace(/。/g, '.')
        .replace(/,/g, '.')  <--------------[add this replace]
        .replace(/[^\w\.-] /g, '')
    );
    this.inputElement.nativeElement.value = `${this.actualValue}`;
  }

}


Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
lppeddcommented, Jul 15, 2019

@vthinkxie 3,000 means 3 basically (I’m from Italy).

2reactions
hulliscommented, Jul 18, 2019

Numbers are even stranger in India.

Read more comments on GitHub >

github_iconTop Results From Across the Web

InputNumber | NG-ZORRO - Ant Design
Angular InputNumber Component, Enter a number within certain range with the mouse or keyboard.When a numeric value needs to be provided.You can get...
Read more >
InputNumber | NG-ZORRO
Angular InputNumber Component, Enter a number within certain range with the mouse or keyboard.When a numeric value needs to be provided.You can get...
Read more >
Change number format of input field in Antd's table-row-edit ...
I understand that the table-component encapsulates an Input-Number component which has the parameter decimalSeparator which I have to adjust. It ...
Read more >
Startup Tasks and Input Arguments in App Designer
To create a startupFcn callback, right-click the app node from the top of the Component Browser hierarchy, and select Callbacks > Add StartupFcn...
Read more >
Add headers, footers, and Bates numbering to PDFs
To search for Bates-numbered PDFs in a PDF Portfolio, open the PDF Portfolio and enter all or part of the Bates number in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found