-
Notifications
You must be signed in to change notification settings - Fork 30.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deps: backport ddb5c2d from V8's upstream
Original commit message: Make NumberFormat use the ICU currency data, fix bug in NumberFormat NumberFormat previously just used a min of 0 digits after the decimal and a max of 3. This CL changes it so that we use the ICU currency data, and set the min and max to the number of numbers after the decimal point for each currency. This CL also fixes a small bug where if the minimum fraction digits is above 3 but the maximum fraction digits isn't set, then it returns with only three numbers after the decimal point. BUG=435465,473104,304722 LOG=Y Review URL: https://codereview.chromium.org/1231613006 Cr-Commit-Position: refs/heads/master@{#29734} PR-URL: #6275 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]>
- Loading branch information
Showing
5 changed files
with
58 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,7 @@ Bert Belder <[email protected]> | |
Burcu Dogan <[email protected]> | ||
Caitlin Potter <[email protected]> | ||
Craig Schlenter <[email protected]> | ||
Chris Nardi <[email protected]> | ||
Christopher A. Taylor <[email protected]> | ||
Daniel Andersson <[email protected]> | ||
Daniel James <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
deps/v8/test/intl/number-format/check-minimum-fraction-digits.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright 2015 the V8 project authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
// Make sure minimumFractionDigits is honored | ||
|
||
var nf = new Intl.NumberFormat("en-us",{ useGrouping: false, minimumFractionDigits: 4}); | ||
|
||
assertEquals("12345.6789", nf.format(12345.6789)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright 2015 the V8 project authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
// Make sure currency formatting is correct (for USD only displays two decimal | ||
// places, for JPY 0, and for EUR 2). | ||
|
||
var nf_USD = new Intl.NumberFormat(['en'], {style: 'currency', currency: 'USD'}); | ||
|
||
assertEquals("$54,306.40", nf_USD.format(parseFloat(54306.4047970))); | ||
|
||
var nf_JPY = new Intl.NumberFormat(['ja'], {style: 'currency', currency: 'JPY'}); | ||
|
||
assertEquals("¥54,306", nf_JPY.format(parseFloat(54306.4047970))); | ||
|
||
var nf_EUR = new Intl.NumberFormat(['pt'], {style: 'currency', currency: 'EUR'}); | ||
|
||
assertEquals("€1.000,00", nf_EUR.format(1000.00)); |