CurrencyFormat puts parenthesis around negative numbers

Hi All,
I have recently made a fresh install of Lucee 6.2 on a new server. Since then the function currencyformat displays all negative numbers with parenthesis no matter what locale I set.

This can be reproduced using the code editor i.e. on LSCurrencyFormat() :: Lucee Documentation. If I use the “Lucee 6 Latest” as engine it puts parenthesis, if I change it to Lucee 5.4 LTS it doesn’t.

Is there a setting/file where I can change this? I would want negative without parenthesis.

Thanks for any help!
Kind regards Daniel

Don’t forget to tell us about your stack!

OS: Windows Server 2022 (10.0) 64bit
Java Version: 21.0.6 (Eclipse Adoptium) 64bit
Tomcat Version: Apache Tomcat/10.1.36
Lucee Version: 6.2.0.321

I just found this here: Issue navigator - Lucee which marks this issue as solved a year ago.

Am I looking at the wrong place or did this issue come back?

As noted per the ticket, java 11 had a quirk, ACF is doing exactly the same?

workaround would be to do the following, you can switch engines to see ACF doing the same

<cfscript>
     n =-1;
     
     writeDump(n);
     writeDump(lsCurrencyFormat(n));
     writeDump(currency(n));
     
     function currency(n){
        if (n >= 0)
            return lsCurrencyFormat(n);
        else
            return "-" & lsCurrencyFormat(abs(n));
     }
</cfscript>

Lucee 6.2.0
image

ACF 2023
image

As you’ll see that produces consistent results between engines

Thanks for the reply Zackster.

I see that ACF does the same thing. But I still don’t understand why negative numbers have parenthesis though. Is it some kind of international formatting convention(?) I have never used this kind of formatting… being in Germany most of the time…

Also, why should a negative “currency number” have parenthesis and a regular number not? Compare lsCurrencyFormat(-1) and lsNumberFormat(-1).

Anyhow, so I guess I have to use the LSnumberformat() and add my currency symbol whenever needed. Not much of a deal in my case. But it make the function lscurrencyformat useless to me.

Thanks so far.
Kind regards Daniel

But I agree, it annoying, so for Lucee 7, I’m adding an optional useBrackets argument

https://luceeserver.atlassian.net/browse/LDEV-5483

1 Like

sounds good. thank you!

1 Like

The historical roots are in bookkeeping to visibly differentiate from positive amounts in financial statements. You’ll see parentheses, red text, etc as options for currency formatting in spreadsheet apps also.