Format money in pt-BR

Tags: #<Tag:0x00007efc6477b020>

Hello, I’m having trouble adjusting the format of a cell.

Money for pt-BR

The user enters the value in different ways and the result is the same but the Handsontable is not detected.

If the user enters 1234,56 the handsontable detects a monetary value and formats it to 1.234,56

However, if the user enters the value 1.234,56 , the handsontable marks the cell with a red background as if it were wrong

Even in this example the bug occurs.
https://jsfiddle.net/Lq8megpy/
In the Price column (Euro)
Entering 1234,56 the same problem occurs.

My Code
Includes
< script src=“https://cdn.jsdelivr.net/npm/handsontable@9.0/dist/handsontable.full.min.js”>/script>
< link type=“text/css” rel=“stylesheet” href=“https://cdn.jsdelivr.net/npm/handsontable@9.0/dist/handsontable.full.min.css” />
< script src=“https://handsontable.com/docs/8.4.0/components/numbro/dist/languages.min.js”>

	data = [{nome:'Thiago', valor: '1254'},{nome:'Eduardo', valor: '5561'}];
	const container = document.getElementById('example');
    const hot = new Handsontable(container, {
	  data: data,
	  colHeaders: ['nome', 'valor'],
	  colWidths: 100,
	  licenseKey: 'non-commercial-and-evaluation', // for non-commercial use only
	  columns: [
	  {
			data: 'nome'
		},
	  {
		data: 'valor',
		type: 'numeric',

		numericFormat: {
			pattern: 'R$ 0,0.00',
    		culture: 'pt-BR'
			},
		},
	  ]
	});		

Has anyone experienced this bug?
Thanks

Hi @thiago.tfigueredo

This is correct behavior. What you see when you type currency format different than it is specified in the pattern is the validator showing that the provided input is different and not correct. The numericFormat option shouldn’t act as a converter, that’s why it gets confused when there is a dot and comma within the value.

Thanks,

What would be the correct formatting for for 1.234,56 in pattern.

I tried it in different ways and the result was always the same.

Thank you for your help

If you want we can schedule a quick call tomorrow and the we can discuss where this issue is coming from :slight_smile: