0

I am using Angular currency pipe to show the amount with currency code transformed according to the locale. It is working as expected. Only in the case of -0 amount it is removing the -ve sign after transforming the amount. Is there a way to show the -0 amount according to a locale with a -ve sign?

Example, For -0 in en-GB locale - The actual output is EUR 0.00 The expected output is EUR -0.00

Pejman Kheyri
  • 4,044
  • 9
  • 32
  • 39
  • I'm curious why you would want to display the `-` – JLRishe May 17 '21 at 05:39
  • Its a business requirement to show it. This amount is to be subtracted from a particular amount. No matter what the amount is. – Anuj Chauhan May 17 '21 at 05:49
  • It would be a big of a hack, but I imagine you could make a pipe that does something like this: `value === 0 ? currency(-1).replace('1', '0') : currency(value)` – JLRishe May 17 '21 at 05:57
  • Maybe you can create a custom pipe. You can extend the CurrencyPipe while you create your pipe. See this answer: https://stackoverflow.com/questions/38971085/extend-a-pipe-like-currency-or-number-on-a-custom-pipe-on-angular2 – Alex Fallenstedt May 17 '21 at 05:59
  • @JLRishe, I could do that in the same pipe. Thanks. – Anuj Chauhan May 17 '21 at 06:14

0 Answers0