|
|
@@ -217,6 +217,8 @@ class Number
|
|
|
* - `zero` - The text to use for zero values, can be a string or a number. e.g. 0, 'Free!'
|
|
|
* - `places` - Number of decimal places to use. e.g. 2
|
|
|
* - `precision` - Maximum Number of decimal places to use, e.g. 2
|
|
|
+ * - `roundingMode` - Rounding mode to use. e.g. NumberFormatter::ROUND_HALF_UP.
|
|
|
+ * When not set locale default will be used
|
|
|
* - `pattern` - An ICU number pattern to use for formatting the number. e.g #,##0.00
|
|
|
* - `useIntlCode` - Whether to replace the currency symbol with the international
|
|
|
* currency code.
|
|
|
@@ -317,6 +319,8 @@ class Number
|
|
|
* numbers representing money or a NumberFormatter constant.
|
|
|
* - `places` - Number of decimal places to use. e.g. 2
|
|
|
* - `precision` - Maximum Number of decimal places to use, e.g. 2
|
|
|
+ * - `roundingMode` - Rounding mode to use. e.g. NumberFormatter::ROUND_HALF_UP.
|
|
|
+ * When not set locale default will be used
|
|
|
* - `pattern` - An ICU number pattern to use for formatting the number. e.g #,##0.00
|
|
|
* - `useIntlCode` - Whether to replace the currency symbol with the international
|
|
|
* currency code.
|
|
|
@@ -387,6 +391,10 @@ class Number
|
|
|
$formatter->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, $options['precision']);
|
|
|
}
|
|
|
|
|
|
+ if (isset($options['roundingMode'])) {
|
|
|
+ $formatter->setAttribute(NumberFormatter::ROUNDING_MODE, $options['roundingMode']);
|
|
|
+ }
|
|
|
+
|
|
|
if (!empty($options['pattern'])) {
|
|
|
$formatter->setPattern($options['pattern']);
|
|
|
}
|