Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(459)

Unified Diff: src/js/i18n.js

Issue 1420883002: Fix user options for fractional digits in Intl.NumberFormatter (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/intl/number-format/check-minimum-fraction-digits.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/i18n.js
diff --git a/src/js/i18n.js b/src/js/i18n.js
index d05da3ef993c540b0febcd60f2fa61a8468e3e0f..0d344d87d7581ccccc7fb9b2e04cad5968e476dc 100644
--- a/src/js/i18n.js
+++ b/src/js/i18n.js
@@ -1101,14 +1101,15 @@ function initializeNumberFormat(numberFormat, locales, options) {
var mnfd = options['minimumFractionDigits'];
var mxfd = options['maximumFractionDigits'];
- if (!IS_UNDEFINED(mnfd) || !internalOptions.style === 'currency') {
+ if (!IS_UNDEFINED(mnfd) || internalOptions.style !== 'currency') {
mnfd = getNumberOption(options, 'minimumFractionDigits', 0, 20, 0);
defineWEProperty(internalOptions, 'minimumFractionDigits', mnfd);
}
- if (!IS_UNDEFINED(mxfd) || !internalOptions.style === 'currency') {
+ if (!IS_UNDEFINED(mxfd) || internalOptions.style !== 'currency') {
+ var min_mxfd = internalOptions.style === 'percent' ? 0 : 3;
mnfd = IS_UNDEFINED(mnfd) ? 0 : mnfd;
- fallback_limit = (mnfd > 3) ? mnfd : 3;
+ fallback_limit = (mnfd > min_mxfd) ? mnfd : min_mxfd;
mxfd = getNumberOption(options, 'maximumFractionDigits', mnfd, 20, fallback_limit);
defineWEProperty(internalOptions, 'maximumFractionDigits', mxfd);
}
« no previous file with comments | « no previous file | test/intl/number-format/check-minimum-fraction-digits.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698