[Custom Masks] DecimalDigits set to 0 in CurrencyMask ends up with 2 digits anyway

Forge Component
Published on 2018-11-14 by Caio Santana Magalhães
26 votes
Published on 2018-11-14 by Caio Santana Magalhães

I am not sure this is a bug or a feature, but when we use 0 for the property DecimalDigits in a MaskCurrency we end up with 2 digits anyway. I looked at the javascript for currency and it says this:

if (decimalDigits != 0) {
        maskOpts = $.extend(maskOpts, {
                digits: decimalDigits

I tried setting my locale options to 0 digits but it's not listening to locale settings either when no digits option is provided in maskOpts.

My hack is the following: I set the DecimalDigits option to -1, this way the if branch is entered and the setting is applied. 

The result is 0 digits in my mask!