OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // ECMAScript 402 API implementation. | 5 // ECMAScript 402 API implementation. |
6 | 6 |
7 /** | 7 /** |
8 * Intl object is a single object that has some named properties, | 8 * Intl object is a single object that has some named properties, |
9 * all of which are constructors. | 9 * all of which are constructors. |
10 */ | 10 */ |
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 defineWEProperty(internalOptions, 'currency', %StringToUpperCase(currency)); | 1094 defineWEProperty(internalOptions, 'currency', %StringToUpperCase(currency)); |
1095 defineWEProperty(internalOptions, 'currencyDisplay', currencyDisplay); | 1095 defineWEProperty(internalOptions, 'currencyDisplay', currencyDisplay); |
1096 } | 1096 } |
1097 | 1097 |
1098 // Digit ranges. | 1098 // Digit ranges. |
1099 var mnid = getNumberOption(options, 'minimumIntegerDigits', 1, 21, 1); | 1099 var mnid = getNumberOption(options, 'minimumIntegerDigits', 1, 21, 1); |
1100 defineWEProperty(internalOptions, 'minimumIntegerDigits', mnid); | 1100 defineWEProperty(internalOptions, 'minimumIntegerDigits', mnid); |
1101 | 1101 |
1102 var mnfd = options['minimumFractionDigits']; | 1102 var mnfd = options['minimumFractionDigits']; |
1103 var mxfd = options['maximumFractionDigits']; | 1103 var mxfd = options['maximumFractionDigits']; |
1104 if (!IS_UNDEFINED(mnfd) || !internalOptions.style === 'currency') { | 1104 if (!IS_UNDEFINED(mnfd) || internalOptions.style !== 'currency') { |
1105 mnfd = getNumberOption(options, 'minimumFractionDigits', 0, 20, 0); | 1105 mnfd = getNumberOption(options, 'minimumFractionDigits', 0, 20, 0); |
1106 defineWEProperty(internalOptions, 'minimumFractionDigits', mnfd); | 1106 defineWEProperty(internalOptions, 'minimumFractionDigits', mnfd); |
1107 } | 1107 } |
1108 | 1108 |
1109 if (!IS_UNDEFINED(mxfd) || !internalOptions.style === 'currency') { | 1109 if (!IS_UNDEFINED(mxfd) || internalOptions.style !== 'currency') { |
| 1110 var min_mxfd = internalOptions.style === 'percent' ? 0 : 3; |
1110 mnfd = IS_UNDEFINED(mnfd) ? 0 : mnfd; | 1111 mnfd = IS_UNDEFINED(mnfd) ? 0 : mnfd; |
1111 fallback_limit = (mnfd > 3) ? mnfd : 3; | 1112 fallback_limit = (mnfd > min_mxfd) ? mnfd : min_mxfd; |
1112 mxfd = getNumberOption(options, 'maximumFractionDigits', mnfd, 20, fallback_
limit); | 1113 mxfd = getNumberOption(options, 'maximumFractionDigits', mnfd, 20, fallback_
limit); |
1113 defineWEProperty(internalOptions, 'maximumFractionDigits', mxfd); | 1114 defineWEProperty(internalOptions, 'maximumFractionDigits', mxfd); |
1114 } | 1115 } |
1115 | 1116 |
1116 var mnsd = options['minimumSignificantDigits']; | 1117 var mnsd = options['minimumSignificantDigits']; |
1117 var mxsd = options['maximumSignificantDigits']; | 1118 var mxsd = options['maximumSignificantDigits']; |
1118 if (!IS_UNDEFINED(mnsd) || !IS_UNDEFINED(mxsd)) { | 1119 if (!IS_UNDEFINED(mnsd) || !IS_UNDEFINED(mxsd)) { |
1119 mnsd = getNumberOption(options, 'minimumSignificantDigits', 1, 21, 0); | 1120 mnsd = getNumberOption(options, 'minimumSignificantDigits', 1, 21, 0); |
1120 defineWEProperty(internalOptions, 'minimumSignificantDigits', mnsd); | 1121 defineWEProperty(internalOptions, 'minimumSignificantDigits', mnsd); |
1121 | 1122 |
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2109 } | 2110 } |
2110 | 2111 |
2111 var locales = %_Arguments(0); | 2112 var locales = %_Arguments(0); |
2112 var options = %_Arguments(1); | 2113 var options = %_Arguments(1); |
2113 return toLocaleDateTime( | 2114 return toLocaleDateTime( |
2114 this, locales, options, 'time', 'time', 'dateformattime'); | 2115 this, locales, options, 'time', 'time', 'dateformattime'); |
2115 } | 2116 } |
2116 ); | 2117 ); |
2117 | 2118 |
2118 }) | 2119 }) |
OLD | NEW |