Yii2: Bug: incorrect formatter output with explicit MIN_FRACTION_DIGITS

Created on 26 Aug 2016  Â·  4Comments  Â·  Source: yiisoft/yii2

'numberFormatterOptions'=>[
                NumberFormatter::MIN_FRACTION_DIGITS => 0,
                NumberFormatter::MAX_FRACTION_DIGITS => 0,
 ]

\Yii::$app->formatter->asCurrency($model->price, 'EUR');

//output 129 517,00 €
ready for adoption bug

Most helpful comment

Fixed, thanks for reporting! Also congrats to the nice issue number :)

All 4 comments

Fixed, thanks for reporting! Also congrats to the nice issue number :)

Have same problem in 2.0.12(intl is 1.1). asCurrency() ignores numberFormatterOptions.
Code after https://github.com/yiisoft/yii2/blob/2.0.12/framework/i18n/Formatter.php#L1373 breaks formatting. If I delete it or place before "// set attributes" comment or delete options in Formatter config (such as decimalSeparator, thousandSeparator) all works fine.

@ptz-nerf please open a new issue and provide the code that produces the problem.

Was this page helpful?
0 / 5 - 0 ratings