| 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 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1096 defineWEProperty(internalOptions, 'currency', %StringToUpperCase(currency)); | 1096 defineWEProperty(internalOptions, 'currency', %StringToUpperCase(currency)); |
| 1097 defineWEProperty(internalOptions, 'currencyDisplay', currencyDisplay); | 1097 defineWEProperty(internalOptions, 'currencyDisplay', currencyDisplay); |
| 1098 } | 1098 } |
| 1099 | 1099 |
| 1100 // Digit ranges. | 1100 // Digit ranges. |
| 1101 var mnid = getNumberOption(options, 'minimumIntegerDigits', 1, 21, 1); | 1101 var mnid = getNumberOption(options, 'minimumIntegerDigits', 1, 21, 1); |
| 1102 defineWEProperty(internalOptions, 'minimumIntegerDigits', mnid); | 1102 defineWEProperty(internalOptions, 'minimumIntegerDigits', mnid); |
| 1103 | 1103 |
| 1104 var mnfd = options['minimumFractionDigits']; | 1104 var mnfd = options['minimumFractionDigits']; |
| 1105 var mxfd = options['maximumFractionDigits']; | 1105 var mxfd = options['maximumFractionDigits']; |
| 1106 if (!IS_UNDEFINED(mnfd) || !internalOptions.style === 'currency') { | 1106 if (!IS_UNDEFINED(mnfd) || internalOptions.style !== 'currency') { |
| 1107 mnfd = getNumberOption(options, 'minimumFractionDigits', 0, 20, 0); | 1107 mnfd = getNumberOption(options, 'minimumFractionDigits', 0, 20, 0); |
| 1108 defineWEProperty(internalOptions, 'minimumFractionDigits', mnfd); | 1108 defineWEProperty(internalOptions, 'minimumFractionDigits', mnfd); |
| 1109 } | 1109 } |
| 1110 | 1110 |
| 1111 if (!IS_UNDEFINED(mxfd) || !internalOptions.style === 'currency') { | 1111 if (!IS_UNDEFINED(mxfd) || internalOptions.style !== 'currency') { |
| 1112 var min_mxfd = internalOptions.style === 'percent' ? 0 : 3; |
| 1112 mnfd = IS_UNDEFINED(mnfd) ? 0 : mnfd; | 1113 mnfd = IS_UNDEFINED(mnfd) ? 0 : mnfd; |
| 1113 fallback_limit = (mnfd > 3) ? mnfd : 3; | 1114 fallback_limit = (mnfd > min_mxfd) ? mnfd : min_mxfd; |
| 1114 mxfd = getNumberOption(options, 'maximumFractionDigits', mnfd, 20, fallback_
limit); | 1115 mxfd = getNumberOption(options, 'maximumFractionDigits', mnfd, 20, fallback_
limit); |
| 1115 defineWEProperty(internalOptions, 'maximumFractionDigits', mxfd); | 1116 defineWEProperty(internalOptions, 'maximumFractionDigits', mxfd); |
| 1116 } | 1117 } |
| 1117 | 1118 |
| 1118 var mnsd = options['minimumSignificantDigits']; | 1119 var mnsd = options['minimumSignificantDigits']; |
| 1119 var mxsd = options['maximumSignificantDigits']; | 1120 var mxsd = options['maximumSignificantDigits']; |
| 1120 if (!IS_UNDEFINED(mnsd) || !IS_UNDEFINED(mxsd)) { | 1121 if (!IS_UNDEFINED(mnsd) || !IS_UNDEFINED(mxsd)) { |
| 1121 mnsd = getNumberOption(options, 'minimumSignificantDigits', 1, 21, 0); | 1122 mnsd = getNumberOption(options, 'minimumSignificantDigits', 1, 21, 0); |
| 1122 defineWEProperty(internalOptions, 'minimumSignificantDigits', mnsd); | 1123 defineWEProperty(internalOptions, 'minimumSignificantDigits', mnsd); |
| 1123 | 1124 |
| (...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2111 } | 2112 } |
| 2112 | 2113 |
| 2113 var locales = %_Arguments(0); | 2114 var locales = %_Arguments(0); |
| 2114 var options = %_Arguments(1); | 2115 var options = %_Arguments(1); |
| 2115 return toLocaleDateTime( | 2116 return toLocaleDateTime( |
| 2116 this, locales, options, 'time', 'time', 'dateformattime'); | 2117 this, locales, options, 'time', 'time', 'dateformattime'); |
| 2117 } | 2118 } |
| 2118 ); | 2119 ); |
| 2119 | 2120 |
| 2120 }) | 2121 }) |
| OLD | NEW |