Hi devs,
I'm trying use BRL currency in @IsCurrency options, but when I use this setting the validator fails:
{
symbol: 'R$',
require_symbol: true,
allow_space_after_symbol: true,
symbol_after_digits: false,
allow_negatives: false,
parens_for_negatives: false,
negative_sign_before_digits: false,
negative_sign_after_digits: false,
allow_negative_sign_placeholder: false,
thousands_separator: '.',
decimal_separator: ',',
allow_decimal: true,
require_decimal: true,
digits_after_decimal: [2],
allow_space_after_digits: false,
}
Value: R$ 1.400,00
"statusCode": 400,
"message": [
"monthyMoneyGoal must be a currency"
],
"error": "Bad Request"
But changing symbol to $ it works:
{
symbol: 'R$',
require_symbol: true,
allow_space_after_symbol: true,
symbol_after_digits: false,
...
}
Value: $ 1.400,00
"statusCode": 200,
"message": [
"Successful update"
],
Changing symbol to $R it unbelievably too works!
Why? Where is error?
PS: My app uses single quotes in Prettier Formatter
Doesnt look like class-validator problem. We use validatorjs isCurrency function. You have to create issue here - https://github.com/validatorjs/validator.js
@vlapo The issue https://github.com/validatorjs/validator.js/issues/1292 was opened.
Thank you! Lets see what validator.js maintainers will says.
@vlapo Fixed in: https://github.com/validatorjs/validator.js/pull/1306
What is the next step?
@btd1337 now we have to update validato.js :) I will try release new version with updated dependencies soon.
Most helpful comment
@btd1337 now we have to update validato.js :) I will try release new version with updated dependencies soon.