formatter decimalseparator

Is yii2 ignoring my configuration?

i’m have this in my web.php

        'formatter' => [

            'dateFormat' => 'dd/MM/yyyy',

            'thousandSeparator' => '.',

            'decimalSeparator' => ',',

            'currencyCode' => 'ARS'


but when I put "20,50" in a input, still saying "…must be a valid number"

there is something missing in my config file?

Sorry for my poor English

I don’t think the validators use the formatter configuration for checking numbers etc (although they possibly should!). If you check the docs for the number validator, it has a pattern for “doubles”, which is ‘/^\s*[-+]?[0-9]\.?[0-9]+([eE][-+]?[0-9]+)?\s$/’ and which will not match the comma in European number formats. You can specify a different one in the validator configuration (and if you make it a static string, you can reuse it) and then you can set it to be whatever format you want, such as:


or more simply


Which doesnt allow whitespace or the E notation.

Changing the validator so that 20,50 is allowed might work.

You could also use masked-input:

But if 20,50 is stored into mysql you will get an error ;)

This money mask input will do the conversion "read from database -> input -> store to database":