How to format number with parentheses on Node.JS

How to format a negative number with parentheses on Node.JS? It is necessary create a function?
tks

I tryed this:

VLPeriodoAnterior<0?’(’+VLPeriodo.abs().formatCurrency(’’, β€˜,’, β€˜.’, 0)+’)’:VLPeriodo.formatCurrency(’’, β€˜,’, β€˜.’, 0)

but, is the best way?

1 Like

What’s the input and what’s the desired output?

it is a simples dmx-text, inside of one a td:

<td dmx-text="VLPeriodo&lt;0?'('+VLPeriodo.abs().formatCurrency('', ',', '.', 0)+')':VLPeriodo.formatCurrency('', ',', '.', 0)" class="bg-light text-body-secondary text-center pointer text-lg-end" dmx-on:click="vCDReceitaDespesa.setValue(CDReceitaDespesa);vDTInicial.setValue(idMesInicial.value.toString().toDate().formatDate('dd-MM-yyyy'));vDTFinal.setValue(idMesInicial.value.toString().toDate().addMonths(1).addDays(-1).formatDate('dd-MM-yyyy'));scRelReceitasDespesas_Detalhe.load({});modal1.show()"></td>

Hehe this is making me very dizzy.
If you want help on how to format, please provide the input and the desired output.
Fore xample you want:
-23,50 to become 25.5

That way someoone can help you

From what I can make of it, he is asking how to format negetive numbers with parentesis.

Example -25.5 to (-25.5)

I could be wrong but that what I get out of it. :slight_smile:

1 Like

-25,5 = (25,50)

1 Like

If it works, it’s fine

Alternatively, you could write a custom formatter