Chromium Code Reviews| Index: src/js/i18n.js |
| diff --git a/src/js/i18n.js b/src/js/i18n.js |
| index ffef1e8954c6d82e9d921eca41c3e95c81766a61..4f9f703716b502f7eee18ff7104153a516ac1260 100644 |
| --- a/src/js/i18n.js |
| +++ b/src/js/i18n.js |
| @@ -1799,6 +1799,20 @@ function formatDate(formatter, dateValue) { |
| new GlobalDate(dateMs)); |
| } |
| +function formatDateToParts(formatter, dateValue) { |
|
Dan Ehrenberg
2016/08/29 21:05:06
Nit: The general V8 convention is to use CamelCase
|
| + var dateMs; |
| + if (IS_UNDEFINED(dateValue)) { |
| + dateMs = %DateCurrentTime(); |
| + } else { |
| + dateMs = TO_NUMBER(dateValue); |
| + } |
| + |
| + if (!NUMBER_IS_FINITE(dateMs)) throw %make_range_error(kDateRange); |
| + |
| + return %InternalDateFormatToParts( |
| + %GetImplFromInitializedIntlObject(formatter), new GlobalDate(dateMs)); |
| +} |
| + |
| /** |
| * Returns a Date object representing the result of calling ToString(value) |
| @@ -2295,6 +2309,7 @@ OverrideFunction(GlobalDate.prototype, 'toLocaleTimeString', function() { |
| utils.Export(function(to) { |
| to.AddBoundMethod = AddBoundMethod; |
| + to.formatDateToParts = formatDateToParts; |
| to.IntlParseDate = IntlParseDate; |
| to.IntlParseNumber = IntlParseNumber; |
| }); |