[INTL] Implement Intl.DateTimeFormat.prototype.formatToParts
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Apr 2017 18:08:03 +0000 (18:08 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Apr 2017 18:08:03 +0000 (18:08 +0000)
commit280480bdeea8317a09ed2b6ce2ed74e01ccaa486
tree3fbec14b1bfd82186bc96679014d66d530236450
parent1f6fbafc34d74c2bebfcdfef7df13b886f72a96e
[INTL] Implement Intl.DateTimeFormat.prototype.formatToParts
https://bugs.webkit.org/show_bug.cgi?id=169458

Patch by Andy VanWagoner <thetalecrafter@gmail.com> on 2017-04-19
Reviewed by JF Bastien.

Source/JavaScriptCore:

Use udat_formatForFields to iterate through the parts of a formatted date string.

* icu/unicode/udat.h: Update to 55.1.
* icu/unicode/ufieldpositer.h: Added from 55.1.
* runtime/IntlDateTimeFormat.cpp:
(JSC::IntlDateTimeFormat::partTypeString): Convert UDateFormatField to string.
(JSC::IntlDateTimeFormat::formatToParts): Return parts of formatted date string.
* runtime/IntlDateTimeFormat.h:
* runtime/IntlDateTimeFormatPrototype.cpp:
(JSC::IntlDateTimeFormatPrototypeFuncFormatToParts): Add prototype function formatToParts.

LayoutTests:

Add tests for formatToParts

* js/intl-datetimeformat-expected.txt:
* js/script-tests/intl-datetimeformat.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215520 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/js/intl-datetimeformat-expected.txt
LayoutTests/js/script-tests/intl-datetimeformat.js
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/icu/unicode/udat.h
Source/JavaScriptCore/icu/unicode/ufieldpositer.h [new file with mode: 0644]
Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp
Source/JavaScriptCore/runtime/IntlDateTimeFormat.h
Source/JavaScriptCore/runtime/IntlDateTimeFormatPrototype.cpp