⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 215616 in webkit


Ignore:
Timestamp:
Apr 21, 2017, 10:58:32 AM (9 years ago)
Author:
commit-queue@webkit.org
Message:

[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-21
Reviewed by JF Bastien.

Source/JavaScriptCore:

Use udat_formatForFields to iterate through the parts of a formatted date string.
Make formatToParts and related functions dependent on ICU version >= 55.

  • icu/unicode/udat.h: Update to 55.1.
  • icu/unicode/ufieldpositer.h: Added from 55.1.
  • icu/unicode/uvernum.h: Update to 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:
Location:
trunk
Files:
1 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r215607 r215616  
     12017-04-21  Andy VanWagoner  <thetalecrafter@gmail.com>
     2
     3        [INTL] Implement Intl.DateTimeFormat.prototype.formatToParts
     4        https://bugs.webkit.org/show_bug.cgi?id=169458
     5
     6        Reviewed by JF Bastien.
     7
     8        Add tests for formatToParts
     9
     10        * js/intl-datetimeformat-expected.txt:
     11        * js/script-tests/intl-datetimeformat.js:
     12
    1132017-04-21  Timothy Horton  <timothy_horton@apple.com>
    214
  • trunk/LayoutTests/js/intl-datetimeformat-expected.txt

    r215526 r215616  
    21562156PASS var legacy = Object.create(Intl.DateTimeFormat.prototype);Intl.DateTimeFormat.call(legacy, 'en-u-nu-arab', { timeZone: 'America/Los_Angeles' }).format(1451099872641) is '١٢/٢٥/٢٠١٥'
    21572157PASS var incompat = {};Intl.DateTimeFormat.apply(incompat) is not incompat
     2158PASS Intl.DateTimeFormat.prototype.formatToParts is an instance of Function
     2159PASS Intl.DateTimeFormat.prototype.formatToParts.length is 0
     2160PASS Object.getOwnPropertyDescriptor(Intl.DateTimeFormat.prototype, 'formatToParts').writable is true
     2161PASS Object.getOwnPropertyDescriptor(Intl.DateTimeFormat.prototype, 'formatToParts').enumerable is false
     2162PASS Object.getOwnPropertyDescriptor(Intl.DateTimeFormat.prototype, 'formatToParts').configurable is true
     2163PASS Object.getOwnPropertyDescriptor(Intl.DateTimeFormat.prototype, 'formatToParts').get is undefined
     2164PASS Object.getOwnPropertyDescriptor(Intl.DateTimeFormat.prototype, 'formatToParts').set is undefined
     2165PASS new Intl.DateTimeFormat().formatToParts({}) threw exception RangeError: date value is not finite in DateTimeFormat formatToParts().
     2166PASS new Intl.DateTimeFormat().formatToParts(NaN) threw exception RangeError: date value is not finite in DateTimeFormat formatToParts().
     2167PASS new Intl.DateTimeFormat().formatToParts(Infinity) threw exception RangeError: date value is not finite in DateTimeFormat formatToParts().
     2168PASS new Intl.DateTimeFormat().formatToParts(-Infinity) threw exception RangeError: date value is not finite in DateTimeFormat formatToParts().
     2169PASS new Intl.DateTimeFormat().formatToParts(new Date(NaN)) threw exception RangeError: date value is not finite in DateTimeFormat formatToParts().
     2170PASS JSON.stringify(
     2171  Intl.DateTimeFormat("pt-BR", {
     2172    hour: "numeric", minute: "numeric", second: "numeric",
     2173    year: "numeric", month: "numeric", day: "numeric",
     2174    timeZoneName: "short", era: "short", timeZone: "UTC"
     2175  }).formatToParts(0).filter((part) => (part.type !== "literal"))
     2176) is JSON.stringify([
     2177  {"type":"day","value":"1"},
     2178  {"type":"month","value":"1"},
     2179  {"type":"year","value":"1970"},
     2180  {"type":"era","value":"d.C."},
     2181  {"type":"hour","value":"00"},
     2182  {"type":"minute","value":"00"},
     2183  {"type":"second","value":"00"},
     2184  {"type":"timeZoneName","value":"GMT"}
     2185])
     2186PASS Intl.DateTimeFormat("ar", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2187PASS Intl.DateTimeFormat("ar", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2188PASS Intl.DateTimeFormat("ar", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2189PASS Intl.DateTimeFormat("ar", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2190PASS Intl.DateTimeFormat("ar", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2191PASS Intl.DateTimeFormat("ar", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2192PASS Intl.DateTimeFormat("ar", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2193PASS Intl.DateTimeFormat("ar-SA", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2194PASS Intl.DateTimeFormat("ar-SA", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2195PASS Intl.DateTimeFormat("ar-SA", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2196PASS Intl.DateTimeFormat("ar-SA", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2197PASS Intl.DateTimeFormat("ar-SA", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2198PASS Intl.DateTimeFormat("ar-SA", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2199PASS Intl.DateTimeFormat("ar-SA", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2200PASS Intl.DateTimeFormat("be", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2201PASS Intl.DateTimeFormat("be", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2202PASS Intl.DateTimeFormat("be", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2203PASS Intl.DateTimeFormat("be", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2204PASS Intl.DateTimeFormat("be", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2205PASS Intl.DateTimeFormat("be", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2206PASS Intl.DateTimeFormat("be", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2207PASS Intl.DateTimeFormat("ca", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2208PASS Intl.DateTimeFormat("ca", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2209PASS Intl.DateTimeFormat("ca", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2210PASS Intl.DateTimeFormat("ca", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2211PASS Intl.DateTimeFormat("ca", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2212PASS Intl.DateTimeFormat("ca", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2213PASS Intl.DateTimeFormat("ca", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2214PASS Intl.DateTimeFormat("cs", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2215PASS Intl.DateTimeFormat("cs", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2216PASS Intl.DateTimeFormat("cs", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2217PASS Intl.DateTimeFormat("cs", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2218PASS Intl.DateTimeFormat("cs", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2219PASS Intl.DateTimeFormat("cs", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2220PASS Intl.DateTimeFormat("cs", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2221PASS Intl.DateTimeFormat("da", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2222PASS Intl.DateTimeFormat("da", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2223PASS Intl.DateTimeFormat("da", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2224PASS Intl.DateTimeFormat("da", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2225PASS Intl.DateTimeFormat("da", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2226PASS Intl.DateTimeFormat("da", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2227PASS Intl.DateTimeFormat("da", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2228PASS Intl.DateTimeFormat("de", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2229PASS Intl.DateTimeFormat("de", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2230PASS Intl.DateTimeFormat("de", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2231PASS Intl.DateTimeFormat("de", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2232PASS Intl.DateTimeFormat("de", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2233PASS Intl.DateTimeFormat("de", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2234PASS Intl.DateTimeFormat("de", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2235PASS Intl.DateTimeFormat("de-CH", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2236PASS Intl.DateTimeFormat("de-CH", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2237PASS Intl.DateTimeFormat("de-CH", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2238PASS Intl.DateTimeFormat("de-CH", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2239PASS Intl.DateTimeFormat("de-CH", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2240PASS Intl.DateTimeFormat("de-CH", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2241PASS Intl.DateTimeFormat("de-CH", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2242PASS Intl.DateTimeFormat("en", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2243PASS Intl.DateTimeFormat("en", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2244PASS Intl.DateTimeFormat("en", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2245PASS Intl.DateTimeFormat("en", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2246PASS Intl.DateTimeFormat("en", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2247PASS Intl.DateTimeFormat("en", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2248PASS Intl.DateTimeFormat("en", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2249PASS Intl.DateTimeFormat("en-AU", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2250PASS Intl.DateTimeFormat("en-AU", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2251PASS Intl.DateTimeFormat("en-AU", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2252PASS Intl.DateTimeFormat("en-AU", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2253PASS Intl.DateTimeFormat("en-AU", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2254PASS Intl.DateTimeFormat("en-AU", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2255PASS Intl.DateTimeFormat("en-AU", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2256PASS Intl.DateTimeFormat("en-GB", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2257PASS Intl.DateTimeFormat("en-GB", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2258PASS Intl.DateTimeFormat("en-GB", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2259PASS Intl.DateTimeFormat("en-GB", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2260PASS Intl.DateTimeFormat("en-GB", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2261PASS Intl.DateTimeFormat("en-GB", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2262PASS Intl.DateTimeFormat("en-GB", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2263PASS Intl.DateTimeFormat("en-PH", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2264PASS Intl.DateTimeFormat("en-PH", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2265PASS Intl.DateTimeFormat("en-PH", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2266PASS Intl.DateTimeFormat("en-PH", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2267PASS Intl.DateTimeFormat("en-PH", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2268PASS Intl.DateTimeFormat("en-PH", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2269PASS Intl.DateTimeFormat("en-PH", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2270PASS Intl.DateTimeFormat("en-US", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2271PASS Intl.DateTimeFormat("en-US", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2272PASS Intl.DateTimeFormat("en-US", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2273PASS Intl.DateTimeFormat("en-US", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2274PASS Intl.DateTimeFormat("en-US", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2275PASS Intl.DateTimeFormat("en-US", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2276PASS Intl.DateTimeFormat("en-US", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2277PASS Intl.DateTimeFormat("el", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2278PASS Intl.DateTimeFormat("el", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2279PASS Intl.DateTimeFormat("el", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2280PASS Intl.DateTimeFormat("el", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2281PASS Intl.DateTimeFormat("el", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2282PASS Intl.DateTimeFormat("el", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2283PASS Intl.DateTimeFormat("el", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2284PASS Intl.DateTimeFormat("es", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2285PASS Intl.DateTimeFormat("es", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2286PASS Intl.DateTimeFormat("es", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2287PASS Intl.DateTimeFormat("es", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2288PASS Intl.DateTimeFormat("es", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2289PASS Intl.DateTimeFormat("es", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2290PASS Intl.DateTimeFormat("es", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2291PASS Intl.DateTimeFormat("es-MX", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2292PASS Intl.DateTimeFormat("es-MX", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2293PASS Intl.DateTimeFormat("es-MX", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2294PASS Intl.DateTimeFormat("es-MX", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2295PASS Intl.DateTimeFormat("es-MX", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2296PASS Intl.DateTimeFormat("es-MX", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2297PASS Intl.DateTimeFormat("es-MX", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2298PASS Intl.DateTimeFormat("es-PR", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2299PASS Intl.DateTimeFormat("es-PR", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2300PASS Intl.DateTimeFormat("es-PR", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2301PASS Intl.DateTimeFormat("es-PR", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2302PASS Intl.DateTimeFormat("es-PR", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2303PASS Intl.DateTimeFormat("es-PR", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2304PASS Intl.DateTimeFormat("es-PR", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2305PASS Intl.DateTimeFormat("fr", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2306PASS Intl.DateTimeFormat("fr", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2307PASS Intl.DateTimeFormat("fr", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2308PASS Intl.DateTimeFormat("fr", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2309PASS Intl.DateTimeFormat("fr", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2310PASS Intl.DateTimeFormat("fr", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2311PASS Intl.DateTimeFormat("fr", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2312PASS Intl.DateTimeFormat("fr-CA", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2313PASS Intl.DateTimeFormat("fr-CA", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2314PASS Intl.DateTimeFormat("fr-CA", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2315PASS Intl.DateTimeFormat("fr-CA", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2316PASS Intl.DateTimeFormat("fr-CA", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2317PASS Intl.DateTimeFormat("fr-CA", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2318PASS Intl.DateTimeFormat("fr-CA", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2319PASS Intl.DateTimeFormat("ga", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2320PASS Intl.DateTimeFormat("ga", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2321PASS Intl.DateTimeFormat("ga", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2322PASS Intl.DateTimeFormat("ga", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2323PASS Intl.DateTimeFormat("ga", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2324PASS Intl.DateTimeFormat("ga", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2325PASS Intl.DateTimeFormat("ga", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2326PASS Intl.DateTimeFormat("hi-IN", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2327PASS Intl.DateTimeFormat("hi-IN", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2328PASS Intl.DateTimeFormat("hi-IN", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2329PASS Intl.DateTimeFormat("hi-IN", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2330PASS Intl.DateTimeFormat("hi-IN", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2331PASS Intl.DateTimeFormat("hi-IN", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2332PASS Intl.DateTimeFormat("hi-IN", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2333PASS Intl.DateTimeFormat("is", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2334PASS Intl.DateTimeFormat("is", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2335PASS Intl.DateTimeFormat("is", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2336PASS Intl.DateTimeFormat("is", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2337PASS Intl.DateTimeFormat("is", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2338PASS Intl.DateTimeFormat("is", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2339PASS Intl.DateTimeFormat("is", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2340PASS Intl.DateTimeFormat("it", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2341PASS Intl.DateTimeFormat("it", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2342PASS Intl.DateTimeFormat("it", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2343PASS Intl.DateTimeFormat("it", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2344PASS Intl.DateTimeFormat("it", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2345PASS Intl.DateTimeFormat("it", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2346PASS Intl.DateTimeFormat("it", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2347PASS Intl.DateTimeFormat("iw", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2348PASS Intl.DateTimeFormat("iw", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2349PASS Intl.DateTimeFormat("iw", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2350PASS Intl.DateTimeFormat("iw", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2351PASS Intl.DateTimeFormat("iw", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2352PASS Intl.DateTimeFormat("iw", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2353PASS Intl.DateTimeFormat("iw", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2354PASS Intl.DateTimeFormat("ja", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2355PASS Intl.DateTimeFormat("ja", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2356PASS Intl.DateTimeFormat("ja", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2357PASS Intl.DateTimeFormat("ja", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2358PASS Intl.DateTimeFormat("ja", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2359PASS Intl.DateTimeFormat("ja", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2360PASS Intl.DateTimeFormat("ja", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2361PASS Intl.DateTimeFormat("ko-KR", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2362PASS Intl.DateTimeFormat("ko-KR", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2363PASS Intl.DateTimeFormat("ko-KR", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2364PASS Intl.DateTimeFormat("ko-KR", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2365PASS Intl.DateTimeFormat("ko-KR", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2366PASS Intl.DateTimeFormat("ko-KR", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2367PASS Intl.DateTimeFormat("ko-KR", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2368PASS Intl.DateTimeFormat("lt", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2369PASS Intl.DateTimeFormat("lt", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2370PASS Intl.DateTimeFormat("lt", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2371PASS Intl.DateTimeFormat("lt", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2372PASS Intl.DateTimeFormat("lt", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2373PASS Intl.DateTimeFormat("lt", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2374PASS Intl.DateTimeFormat("lt", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2375PASS Intl.DateTimeFormat("lv", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2376PASS Intl.DateTimeFormat("lv", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2377PASS Intl.DateTimeFormat("lv", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2378PASS Intl.DateTimeFormat("lv", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2379PASS Intl.DateTimeFormat("lv", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2380PASS Intl.DateTimeFormat("lv", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2381PASS Intl.DateTimeFormat("lv", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2382PASS Intl.DateTimeFormat("mk", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2383PASS Intl.DateTimeFormat("mk", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2384PASS Intl.DateTimeFormat("mk", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2385PASS Intl.DateTimeFormat("mk", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2386PASS Intl.DateTimeFormat("mk", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2387PASS Intl.DateTimeFormat("mk", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2388PASS Intl.DateTimeFormat("mk", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2389PASS Intl.DateTimeFormat("ms", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2390PASS Intl.DateTimeFormat("ms", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2391PASS Intl.DateTimeFormat("ms", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2392PASS Intl.DateTimeFormat("ms", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2393PASS Intl.DateTimeFormat("ms", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2394PASS Intl.DateTimeFormat("ms", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2395PASS Intl.DateTimeFormat("ms", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2396PASS Intl.DateTimeFormat("mt", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2397PASS Intl.DateTimeFormat("mt", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2398PASS Intl.DateTimeFormat("mt", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2399PASS Intl.DateTimeFormat("mt", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2400PASS Intl.DateTimeFormat("mt", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2401PASS Intl.DateTimeFormat("mt", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2402PASS Intl.DateTimeFormat("mt", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2403PASS Intl.DateTimeFormat("nb", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2404PASS Intl.DateTimeFormat("nb", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2405PASS Intl.DateTimeFormat("nb", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2406PASS Intl.DateTimeFormat("nb", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2407PASS Intl.DateTimeFormat("nb", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2408PASS Intl.DateTimeFormat("nb", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2409PASS Intl.DateTimeFormat("nb", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2410PASS Intl.DateTimeFormat("nl", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2411PASS Intl.DateTimeFormat("nl", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2412PASS Intl.DateTimeFormat("nl", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2413PASS Intl.DateTimeFormat("nl", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2414PASS Intl.DateTimeFormat("nl", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2415PASS Intl.DateTimeFormat("nl", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2416PASS Intl.DateTimeFormat("nl", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2417PASS Intl.DateTimeFormat("no", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2418PASS Intl.DateTimeFormat("no", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2419PASS Intl.DateTimeFormat("no", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2420PASS Intl.DateTimeFormat("no", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2421PASS Intl.DateTimeFormat("no", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2422PASS Intl.DateTimeFormat("no", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2423PASS Intl.DateTimeFormat("no", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2424PASS Intl.DateTimeFormat("pl", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2425PASS Intl.DateTimeFormat("pl", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2426PASS Intl.DateTimeFormat("pl", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2427PASS Intl.DateTimeFormat("pl", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2428PASS Intl.DateTimeFormat("pl", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2429PASS Intl.DateTimeFormat("pl", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2430PASS Intl.DateTimeFormat("pl", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2431PASS Intl.DateTimeFormat("pt", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2432PASS Intl.DateTimeFormat("pt", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2433PASS Intl.DateTimeFormat("pt", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2434PASS Intl.DateTimeFormat("pt", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2435PASS Intl.DateTimeFormat("pt", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2436PASS Intl.DateTimeFormat("pt", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2437PASS Intl.DateTimeFormat("pt", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2438PASS Intl.DateTimeFormat("pt-BR", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2439PASS Intl.DateTimeFormat("pt-BR", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2440PASS Intl.DateTimeFormat("pt-BR", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2441PASS Intl.DateTimeFormat("pt-BR", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2442PASS Intl.DateTimeFormat("pt-BR", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2443PASS Intl.DateTimeFormat("pt-BR", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2444PASS Intl.DateTimeFormat("pt-BR", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2445PASS Intl.DateTimeFormat("ro", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2446PASS Intl.DateTimeFormat("ro", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2447PASS Intl.DateTimeFormat("ro", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2448PASS Intl.DateTimeFormat("ro", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2449PASS Intl.DateTimeFormat("ro", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2450PASS Intl.DateTimeFormat("ro", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2451PASS Intl.DateTimeFormat("ro", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2452PASS Intl.DateTimeFormat("ru", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2453PASS Intl.DateTimeFormat("ru", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2454PASS Intl.DateTimeFormat("ru", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2455PASS Intl.DateTimeFormat("ru", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2456PASS Intl.DateTimeFormat("ru", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2457PASS Intl.DateTimeFormat("ru", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2458PASS Intl.DateTimeFormat("ru", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2459PASS Intl.DateTimeFormat("sk", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2460PASS Intl.DateTimeFormat("sk", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2461PASS Intl.DateTimeFormat("sk", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2462PASS Intl.DateTimeFormat("sk", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2463PASS Intl.DateTimeFormat("sk", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2464PASS Intl.DateTimeFormat("sk", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2465PASS Intl.DateTimeFormat("sk", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2466PASS Intl.DateTimeFormat("sl", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2467PASS Intl.DateTimeFormat("sl", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2468PASS Intl.DateTimeFormat("sl", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2469PASS Intl.DateTimeFormat("sl", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2470PASS Intl.DateTimeFormat("sl", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2471PASS Intl.DateTimeFormat("sl", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2472PASS Intl.DateTimeFormat("sl", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2473PASS Intl.DateTimeFormat("sr", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2474PASS Intl.DateTimeFormat("sr", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2475PASS Intl.DateTimeFormat("sr", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2476PASS Intl.DateTimeFormat("sr", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2477PASS Intl.DateTimeFormat("sr", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2478PASS Intl.DateTimeFormat("sr", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2479PASS Intl.DateTimeFormat("sr", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2480PASS Intl.DateTimeFormat("sv", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2481PASS Intl.DateTimeFormat("sv", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2482PASS Intl.DateTimeFormat("sv", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2483PASS Intl.DateTimeFormat("sv", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2484PASS Intl.DateTimeFormat("sv", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2485PASS Intl.DateTimeFormat("sv", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2486PASS Intl.DateTimeFormat("sv", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2487PASS Intl.DateTimeFormat("th", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2488PASS Intl.DateTimeFormat("th", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2489PASS Intl.DateTimeFormat("th", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2490PASS Intl.DateTimeFormat("th", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2491PASS Intl.DateTimeFormat("th", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2492PASS Intl.DateTimeFormat("th", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2493PASS Intl.DateTimeFormat("th", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2494PASS Intl.DateTimeFormat("tr", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2495PASS Intl.DateTimeFormat("tr", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2496PASS Intl.DateTimeFormat("tr", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2497PASS Intl.DateTimeFormat("tr", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2498PASS Intl.DateTimeFormat("tr", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2499PASS Intl.DateTimeFormat("tr", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2500PASS Intl.DateTimeFormat("tr", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2501PASS Intl.DateTimeFormat("uk", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2502PASS Intl.DateTimeFormat("uk", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2503PASS Intl.DateTimeFormat("uk", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2504PASS Intl.DateTimeFormat("uk", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2505PASS Intl.DateTimeFormat("uk", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2506PASS Intl.DateTimeFormat("uk", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2507PASS Intl.DateTimeFormat("uk", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2508PASS Intl.DateTimeFormat("vi", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2509PASS Intl.DateTimeFormat("vi", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2510PASS Intl.DateTimeFormat("vi", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2511PASS Intl.DateTimeFormat("vi", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2512PASS Intl.DateTimeFormat("vi", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2513PASS Intl.DateTimeFormat("vi", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2514PASS Intl.DateTimeFormat("vi", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2515PASS Intl.DateTimeFormat("zh", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2516PASS Intl.DateTimeFormat("zh", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2517PASS Intl.DateTimeFormat("zh", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2518PASS Intl.DateTimeFormat("zh", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2519PASS Intl.DateTimeFormat("zh", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2520PASS Intl.DateTimeFormat("zh", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2521PASS Intl.DateTimeFormat("zh", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2522PASS Intl.DateTimeFormat("zh-CN", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2523PASS Intl.DateTimeFormat("zh-CN", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2524PASS Intl.DateTimeFormat("zh-CN", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2525PASS Intl.DateTimeFormat("zh-CN", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2526PASS Intl.DateTimeFormat("zh-CN", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2527PASS Intl.DateTimeFormat("zh-CN", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2528PASS Intl.DateTimeFormat("zh-CN", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2529PASS Intl.DateTimeFormat("zh-Hant-HK", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2530PASS Intl.DateTimeFormat("zh-Hant-HK", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2531PASS Intl.DateTimeFormat("zh-Hant-HK", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2532PASS Intl.DateTimeFormat("zh-Hant-HK", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2533PASS Intl.DateTimeFormat("zh-Hant-HK", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2534PASS Intl.DateTimeFormat("zh-Hant-HK", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2535PASS Intl.DateTimeFormat("zh-Hant-HK", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2536PASS Intl.DateTimeFormat("zh-TW", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2537PASS Intl.DateTimeFormat("zh-TW", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts() is an instance of Array
     2538PASS Intl.DateTimeFormat("zh-TW", { year: "numeric", month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2539PASS Intl.DateTimeFormat("zh-TW", { year: "numeric", month: "long" }).formatToParts() is an instance of Array
     2540PASS Intl.DateTimeFormat("zh-TW", { month: "long", day: "numeric" }).formatToParts() is an instance of Array
     2541PASS Intl.DateTimeFormat("zh-TW", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts() is an instance of Array
     2542PASS Intl.DateTimeFormat("zh-TW", { hour: "numeric", minute: "numeric" }).formatToParts() is an instance of Array
     2543PASS JSON.stringify(
     2544  Intl.DateTimeFormat('en-US', {
     2545    hour: "numeric", minute: "numeric", second: "numeric",
     2546    year: "numeric", month: "long", day: "numeric", weekday: "long",
     2547    timeZoneName: "long", era: "long", timeZone: "UTC"
     2548  }).formatToParts(0)
     2549) is JSON.stringify([
     2550  {"type":"weekday","value":"Thursday"},
     2551  {"type":"literal","value":", "},
     2552  {"type":"month","value":"January"},
     2553  {"type":"literal","value":" "},
     2554  {"type":"day","value":"1"},
     2555  {"type":"literal","value":", "},
     2556  {"type":"year","value":"1970"},
     2557  {"type":"literal","value":" "},
     2558  {"type":"era","value":"Anno Domini"},
     2559  {"type":"literal","value":", "},
     2560  {"type":"hour","value":"12"},
     2561  {"type":"literal","value":":"},
     2562  {"type":"minute","value":"00"},
     2563  {"type":"literal","value":":"},
     2564  {"type":"second","value":"00"},
     2565  {"type":"literal","value":" "},
     2566  {"type":"dayPeriod","value":"AM"},
     2567  {"type":"literal","value":" "},
     2568  {"type":"timeZoneName","value":"GMT"}
     2569])
    21582570PASS successfullyParsed is true
    21592571
  • trunk/LayoutTests/js/script-tests/intl-datetimeformat.js

    r215526 r215616  
    515515shouldBe(legacyInit + "Intl.DateTimeFormat.call(legacy, 'en-u-nu-arab', { timeZone: 'America/Los_Angeles' }).format(1451099872641)", "'١٢/٢٥/٢٠١٥'");
    516516shouldNotBe("var incompat = {};Intl.DateTimeFormat.apply(incompat)", "incompat");
     517
     518// ECMA-402 4th edition 15.4 Intl.DateTimeFormat.prototype.formatToParts
     519shouldBeType("Intl.DateTimeFormat.prototype.formatToParts", "Function");
     520shouldBe("Intl.DateTimeFormat.prototype.formatToParts.length", "0");
     521shouldBeTrue("Object.getOwnPropertyDescriptor(Intl.DateTimeFormat.prototype, 'formatToParts').writable");
     522shouldBeFalse("Object.getOwnPropertyDescriptor(Intl.DateTimeFormat.prototype, 'formatToParts').enumerable");
     523shouldBeTrue("Object.getOwnPropertyDescriptor(Intl.DateTimeFormat.prototype, 'formatToParts').configurable");
     524shouldBe("Object.getOwnPropertyDescriptor(Intl.DateTimeFormat.prototype, 'formatToParts').get", "undefined");
     525shouldBe("Object.getOwnPropertyDescriptor(Intl.DateTimeFormat.prototype, 'formatToParts').set", "undefined");
     526
     527// Throws on non-finite or non-number
     528shouldThrow("new Intl.DateTimeFormat().formatToParts({})", "'RangeError: date value is not finite in DateTimeFormat formatToParts()'");
     529shouldThrow("new Intl.DateTimeFormat().formatToParts(NaN)", "'RangeError: date value is not finite in DateTimeFormat formatToParts()'");
     530shouldThrow("new Intl.DateTimeFormat().formatToParts(Infinity)", "'RangeError: date value is not finite in DateTimeFormat formatToParts()'");
     531shouldThrow("new Intl.DateTimeFormat().formatToParts(-Infinity)", "'RangeError: date value is not finite in DateTimeFormat formatToParts()'");
     532shouldThrow("new Intl.DateTimeFormat().formatToParts(new Date(NaN))", "'RangeError: date value is not finite in DateTimeFormat formatToParts()'");
     533
     534shouldBe(`JSON.stringify(
     535  Intl.DateTimeFormat("pt-BR", {
     536    hour: "numeric", minute: "numeric", second: "numeric",
     537    year: "numeric", month: "numeric", day: "numeric",
     538    timeZoneName: "short", era: "short", timeZone: "UTC"
     539  }).formatToParts(0).filter((part) => (part.type !== "literal"))
     540)`, `JSON.stringify([
     541  {"type":"day","value":"1"},
     542  {"type":"month","value":"1"},
     543  {"type":"year","value":"1970"},
     544  {"type":"era","value":"d.C."},
     545  {"type":"hour","value":"00"},
     546  {"type":"minute","value":"00"},
     547  {"type":"second","value":"00"},
     548  {"type":"timeZoneName","value":"GMT"}
     549])`);
     550
     551for (let locale of localesSample) {
     552  // The following subsets must be available for each locale:
     553  // weekday, year, month, day, hour, minute, second
     554  shouldBeType(`Intl.DateTimeFormat("${locale}", { weekday: "short", year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts()`, "Array");
     555  // weekday, year, month, day
     556  shouldBeType(`Intl.DateTimeFormat("${locale}", { weekday: "short", year: "numeric", month: "short", day: "numeric" }).formatToParts()`, "Array");
     557  // year, month, day
     558  shouldBeType(`Intl.DateTimeFormat("${locale}", { year: "numeric", month: "long", day: "numeric" }).formatToParts()`, "Array");
     559  // year, month
     560  shouldBeType(`Intl.DateTimeFormat("${locale}", { year: "numeric", month: "long" }).formatToParts()`, "Array");
     561  // month, day
     562  shouldBeType(`Intl.DateTimeFormat("${locale}", { month: "long", day: "numeric" }).formatToParts()`, "Array");
     563  // hour, minute, second
     564  shouldBeType(`Intl.DateTimeFormat("${locale}", { hour: "numeric", minute: "numeric", second: "numeric" }).formatToParts()`, "Array");
     565  // hour, minute
     566  shouldBeType(`Intl.DateTimeFormat("${locale}", { hour: "numeric", minute: "numeric" }).formatToParts()`, "Array");
     567}
     568
     569// Exceed the 32 character default buffer size
     570shouldBe(`JSON.stringify(
     571  Intl.DateTimeFormat('en-US', {
     572    hour: "numeric", minute: "numeric", second: "numeric",
     573    year: "numeric", month: "long", day: "numeric", weekday: "long",
     574    timeZoneName: "long", era: "long", timeZone: "UTC"
     575  }).formatToParts(0)
     576)`, `JSON.stringify([
     577  {"type":"weekday","value":"Thursday"},
     578  {"type":"literal","value":", "},
     579  {"type":"month","value":"January"},
     580  {"type":"literal","value":" "},
     581  {"type":"day","value":"1"},
     582  {"type":"literal","value":", "},
     583  {"type":"year","value":"1970"},
     584  {"type":"literal","value":" "},
     585  {"type":"era","value":"Anno Domini"},
     586  {"type":"literal","value":", "},
     587  {"type":"hour","value":"12"},
     588  {"type":"literal","value":":"},
     589  {"type":"minute","value":"00"},
     590  {"type":"literal","value":":"},
     591  {"type":"second","value":"00"},
     592  {"type":"literal","value":" "},
     593  {"type":"dayPeriod","value":"AM"},
     594  {"type":"literal","value":" "},
     595  {"type":"timeZoneName","value":"GMT"}
     596])`)
     597
  • trunk/Source/JavaScriptCore/ChangeLog

    r215606 r215616  
     12017-04-21  Andy VanWagoner  <thetalecrafter@gmail.com>
     2
     3        [INTL] Implement Intl.DateTimeFormat.prototype.formatToParts
     4        https://bugs.webkit.org/show_bug.cgi?id=169458
     5
     6        Reviewed by JF Bastien.
     7
     8        Use udat_formatForFields to iterate through the parts of a formatted date string.
     9        Make formatToParts and related functions dependent on ICU version >= 55.
     10
     11        * icu/unicode/udat.h: Update to 55.1.
     12        * icu/unicode/ufieldpositer.h: Added from 55.1.
     13        * icu/unicode/uvernum.h: Update to 55.1
     14        * runtime/IntlDateTimeFormat.cpp:
     15        (JSC::IntlDateTimeFormat::partTypeString): Convert UDateFormatField to string.
     16        (JSC::IntlDateTimeFormat::formatToParts): Return parts of formatted date string.
     17        * runtime/IntlDateTimeFormat.h:
     18        * runtime/IntlDateTimeFormatPrototype.cpp:
     19        (JSC::IntlDateTimeFormatPrototypeFuncFormatToParts): Add prototype function formatToParts.
     20
    1212017-04-20  Konstantin Tokarev  <annulen@yandex.ru>
    222
  • trunk/Source/JavaScriptCore/icu/unicode/udat.h

    r215526 r215616  
    11/*
    22 *******************************************************************************
    3  * Copyright (C) 1996-2013, International Business Machines
     3 * Copyright (C) 1996-2015, International Business Machines
    44 * Corporation and others. All Rights Reserved.
    55 *******************************************************************************
     
    1717#include "unicode/unum.h"
    1818#include "unicode/udisplaycontext.h"
     19#include "unicode/ufieldpositer.h"
    1920/**
    2021 * \file
     
    187188    UDAT_PATTERN = -2,
    188189
     190#ifndef U_HIDE_INTERNAL_API
    189191    /** @internal alias to UDAT_PATTERN */
    190192    UDAT_IGNORE = UDAT_PATTERN
     193#endif /* U_HIDE_INTERNAL_API */
    191194} UDateFormatStyle;
    192195
     
    198201 */
    199202#define UDAT_YEAR                       "y"
    200 #ifndef U_HIDE_DRAFT_API
    201203/**
    202204 * Constant for date skeleton with quarter.
    203  * @draft ICU 51
     205 * @stable ICU 51
    204206 */
    205207#define UDAT_QUARTER                    "QQQQ"
    206208/**
    207209 * Constant for date skeleton with abbreviated quarter.
    208  * @draft ICU 51
     210 * @stable ICU 51
    209211 */
    210212#define UDAT_ABBR_QUARTER               "QQQ"
    211 #endif  /* U_HIDE_DRAFT_API */
    212213/**
    213214 * Constant for date skeleton with year and quarter.
     
    273274 */
    274275#define UDAT_YEAR_NUM_MONTH_DAY         "yMd"
    275 #ifndef U_HIDE_DRAFT_API
    276276/**
    277277 * Constant for date skeleton with weekday.
    278  * @draft ICU 51
     278 * @stable ICU 51
    279279 */
    280280#define UDAT_WEEKDAY                    "EEEE"
    281281/**
    282282 * Constant for date skeleton with abbreviated weekday.
    283  * @draft ICU 51
     283 * @stable ICU 51
    284284 */
    285285#define UDAT_ABBR_WEEKDAY               "E"
    286 #endif  /* U_HIDE_DRAFT_API */
    287286/**
    288287 * Constant for date skeleton with year, month, weekday, and day.
     
    347346 */
    348347#define UDAT_HOUR                       "j"
    349 #ifndef U_HIDE_DRAFT_API
    350348/**
    351349 * Constant for date skeleton with hour in 24-hour presentation.
    352  * @draft ICU 51
     350 * @stable ICU 51
    353351 */
    354352#define UDAT_HOUR24                     "H"
    355353/**
    356354 * Constant for date skeleton with minute.
    357  * @draft ICU 51
     355 * @stable ICU 51
    358356 */
    359357#define UDAT_MINUTE                     "m"
    360 #endif  /* U_HIDE_DRAFT_API */
    361358/**
    362359 * Constant for date skeleton with hour and minute, with the locale's preferred hour format (12 or 24).
     
    371368 */
    372369#define UDAT_HOUR24_MINUTE              "Hm"
    373 #ifndef U_HIDE_DRAFT_API
    374370/**
    375371 * Constant for date skeleton with second.
    376  * @draft ICU 51
     372 * @stable ICU 51
    377373 */
    378374#define UDAT_SECOND                     "s"
    379 #endif  /* U_HIDE_DRAFT_API */
    380375/**
    381376 * Constant for date skeleton with hour, minute, and second,
     
    401396/* Skeletons for time zones. */
    402397
    403 #ifndef U_HIDE_DRAFT_API
    404398/**
    405399 * Constant for <i>generic location format</i>, such as Los Angeles Time;
     
    407401 * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a>
    408402 * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a>
    409  * @draft ICU 51
     403 * @stable ICU 51
    410404 */
    411405#define UDAT_LOCATION_TZ "VVVV"
     
    415409 * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a>
    416410 * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a>
    417  * @draft ICU 51
     411 * @stable ICU 51
    418412 */
    419413#define UDAT_GENERIC_TZ "vvvv"
     
    423417 * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a>
    424418 * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a>
    425  * @draft ICU 51
     419 * @stable ICU 51
    426420 */
    427421#define UDAT_ABBR_GENERIC_TZ "v"
     
    431425 * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a>
    432426 * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a>
    433  * @draft ICU 51
     427 * @stable ICU 51
    434428 */
    435429#define UDAT_SPECIFIC_TZ "zzzz"
     
    439433 * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a>
    440434 * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a>
    441  * @draft ICU 51
     435 * @stable ICU 51
    442436 */
    443437#define UDAT_ABBR_SPECIFIC_TZ "z"
     
    447441 * @see <a href="http://unicode.org/reports/tr35/#Date_Format_Patterns">LDML Date Format Patterns</a>
    448442 * @see <a href="http://unicode.org/reports/tr35/#Time_Zone_Fallback">LDML Time Zone Fallback</a>
    449  * @draft ICU 51
     443 * @stable ICU 51
    450444 */
    451445#define UDAT_ABBR_UTC_TZ "ZZZZ"
    452 #endif  /* U_HIDE_DRAFT_API */
    453446
    454447/* deprecated skeleton constants */
     
    736729    UDAT_YEAR_NAME_FIELD = 30,
    737730
    738 #ifndef U_HIDE_DRAFT_API
    739731    /**
    740732     * FieldPosition selector for 'O' field alignment,
    741733     * corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OFFSETfields.
    742734     * This displays the localized GMT format.
    743      * @draft ICU 51
     735     * @stable ICU 51
    744736     */
    745737    UDAT_TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD = 31,
     
    749741     * corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OFFSETfields.
    750742     * This displays the ISO 8601 local time offset format or UTC indicator ("Z").
    751      * @draft ICU 51
     743     * @stable ICU 51
    752744     */
    753745    UDAT_TIMEZONE_ISO_FIELD = 32,
     
    755747    /**
    756748     * FieldPosition selector for 'x' field alignment,
    757      * corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OFFSETfields.
     749     * corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OFFSET fields.
    758750     * This displays the ISO 8601 local time offset format.
    759      * @draft ICU 51
     751     * @stable ICU 51
    760752     */
    761753    UDAT_TIMEZONE_ISO_LOCAL_FIELD = 33,
     754
     755#ifndef U_HIDE_INTERNAL_API
     756    /**
     757     * FieldPosition and UFieldPosition selector for 'r' field alignment,
     758     * no directly corresponding UCAL_ field.
     759     * @internal ICU 53
     760     */
     761    UDAT_RELATED_YEAR_FIELD = 34,
     762#endif /* U_HIDE_INTERNAL_API */
     763
     764#ifndef U_HIDE_DRAFT_API
     765    /**
     766     * FieldPosition and UFieldPosition selector for ':' time separator,
     767     * no corresponding UCAL_ field.
     768     * @draft ICU 55
     769     */
     770    UDAT_TIME_SEPARATOR_FIELD = 35,
    762771#endif  /* U_HIDE_DRAFT_API */
    763772
    764     /**
     773   /**
    765774     * Number of FieldPosition and UFieldPosition selectors for
    766775     * DateFormat and UDateFormat.
     
    770779     * @stable ICU 3.0
    771780     */
    772     UDAT_FIELD_COUNT = 34
     781    UDAT_FIELD_COUNT = 36
    773782
    774783} UDateFormatField;
     
    838847/**
    839848 * DateFormat boolean attributes
    840  * @internal ICU technology preview
     849 *
     850 * @stable ICU 53
    841851 */
    842852typedef enum UDateFormatBooleanAttribute {
    843     /**
     853   /**
    844854     * indicates whether whitespace is allowed. Includes trailing dot tolerance.
    845      * @internal ICU technology preview
    846      */
    847     UDAT_PARSE_ALLOW_WHITESPACE,
     855     * @stable ICU 53
     856     */
     857    UDAT_PARSE_ALLOW_WHITESPACE = 0,
    848858    /**
    849859     * indicates tolerance of numeric data when String data may be assumed. eg: UDAT_YEAR_NAME_FIELD,
    850860     * UDAT_STANDALONE_MONTH_FIELD, UDAT_DAY_OF_WEEK_FIELD
    851      * @internal ICU technology preview
    852      */
    853     UDAT_PARSE_ALLOW_NUMERIC,
     861     * @stable ICU 53
     862     */
     863    UDAT_PARSE_ALLOW_NUMERIC = 1,
     864#ifndef U_HIDE_DRAFT_API
     865    /**
     866     * indicates tolerance of a partial literal match
     867     * @draft ICU 53
     868     */
     869    UDAT_PARSE_PARTIAL_MATCH = 2,
     870    /** 
     871     * indicates tolerance of pattern mismatch between input data and specified format pattern.
     872     * e.g. accepting "September" for a month pattern of MMM ("Sep")   
     873     * @draft ICU 53
     874     */
     875    UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH = 3,
     876#endif /* U_HIDE_DRAFT_API */
    854877    /**
    855878     * count boolean date format constants
    856      * @internal ICU technology preview
    857      */
    858     UDAT_BOOLEAN_ATTRIBUTE_COUNT
     879     * @stable ICU 53
     880     */
     881    UDAT_BOOLEAN_ATTRIBUTE_COUNT = 4
    859882} UDateFormatBooleanAttribute;
    860883
    861 #ifndef U_HIDE_INTERNAL_API
    862884/**
    863885 * Get a boolean attribute associated with a UDateFormat.
     
    868890 * @param status A pointer to an UErrorCode to receive any errors
    869891 * @return The value of attr.
    870  * @internal technology preview
    871  */
    872 U_INTERNAL UBool U_EXPORT2
     892 * @stable ICU 53
     893 */
     894U_STABLE UBool U_EXPORT2
    873895udat_getBooleanAttribute(const UDateFormat* fmt, UDateFormatBooleanAttribute attr, UErrorCode* status);
    874896
     
    881903 * @param newValue The new value of attr.
    882904 * @param status A pointer to an UErrorCode to receive any errors
    883  * @internal ICU technology preview
    884  */
    885 U_INTERNAL void U_EXPORT2
    886 udat_setBooleanAttribute(UDateFormat *fmt, UDateFormatBooleanAttribute attr, UBool, UErrorCode* status);
    887 
    888 #endif  /* U_HIDE_INTERNAL_API */
     905 * @stable ICU 53
     906 */
     907U_STABLE void U_EXPORT2
     908udat_setBooleanAttribute(UDateFormat *fmt, UDateFormatBooleanAttribute attr, UBool newValue, UErrorCode* status);
    889909
    890910
     
    922942
    923943/**
    924 * Format a date using an UDateFormat.
     944* Format a date using a UDateFormat.
    925945* The date will be formatted using the conventions specified in {@link #udat_open }
    926946* @param format The formatter to use
     
    946966                        UFieldPosition* position,
    947967                        UErrorCode*     status);
     968
     969#ifndef U_HIDE_DRAFT_API
     970/**
     971* Format a date using an UDateFormat.
     972* The date will be formatted using the conventions specified in {@link #udat_open }
     973* @param format The formatter to use
     974* @param calendar The calendar to format. The calendar instance might be
     975*                 mutated if fields are not yet fully calculated, though
     976*                 the function won't change the logical date and time held
     977*                 by the instance.
     978* @param result A pointer to a buffer to receive the formatted number.
     979* @param capacity The maximum size of result.
     980* @param position A pointer to a UFieldPosition.  On input, position->field
     981* is read.  On output, position->beginIndex and position->endIndex indicate
     982* the beginning and ending indices of field number position->field, if such
     983* a field exists.  This parameter may be NULL, in which case no field
     984* position data is returned.
     985* @param status A pointer to an UErrorCode to receive any errors
     986* @return The total buffer size needed; if greater than resultLength, the output was truncated.
     987* @see udat_format
     988* @see udat_parseCalendar
     989* @see UFieldPosition
     990* @draft ICU 55
     991*/
     992U_DRAFT int32_t U_EXPORT2
     993udat_formatCalendar(    const UDateFormat*  format,
     994                        UCalendar*      calendar,
     995                        UChar*          result,
     996                        int32_t         capacity,
     997                        UFieldPosition* position,
     998                        UErrorCode*     status);
     999
     1000/**
     1001* Format a date using a UDateFormat.
     1002* The date will be formatted using the conventions specified in {@link #udat_open}
     1003* @param format
     1004*          The formatter to use
     1005* @param dateToFormat
     1006*          The date to format
     1007* @param result
     1008*          A pointer to a buffer to receive the formatted number.
     1009* @param resultLength
     1010*          The maximum size of result.
     1011* @param fpositer
     1012*          A pointer to a UFieldPositionIterator created by {@link #ufieldpositer_open}
     1013*          (may be NULL if field position information is not needed). Any
     1014*          iteration information already present in the UFieldPositionIterator
     1015*          will be deleted, and the iterator will be reset to apply to the
     1016*          fields in the formatted string created by this function call; the
     1017*          field values provided by {@link #ufieldpositer_next} will be from the
     1018*          UDateFormatField enum.
     1019* @param status
     1020*          A pointer to a UErrorCode to receive any errors
     1021* @return
     1022*          The total buffer size needed; if greater than resultLength, the output was truncated.
     1023* @see udat_parse
     1024* @see UFieldPositionIterator
     1025* @draft ICU 55
     1026*/
     1027U_DRAFT int32_t U_EXPORT2
     1028udat_formatForFields(   const UDateFormat* format,
     1029                        UDate           dateToFormat,
     1030                        UChar*          result,
     1031                        int32_t         resultLength,
     1032                        UFieldPositionIterator* fpositer,
     1033                        UErrorCode*     status);
     1034
     1035/**
     1036* Format a date using a UDateFormat.
     1037* The date will be formatted using the conventions specified in {@link #udat_open }
     1038* @param format
     1039*          The formatter to use
     1040* @param calendar
     1041*          The calendar to format. The calendar instance might be mutated if fields
     1042*          are not yet fully calculated, though the function won't change the logical
     1043*          date and time held by the instance.
     1044* @param result
     1045*          A pointer to a buffer to receive the formatted number.
     1046* @param capacity
     1047*          The maximum size of result.
     1048* @param fpositer
     1049*          A pointer to a UFieldPositionIterator created by {@link #ufieldpositer_open}
     1050*          (may be NULL if field position information is not needed). Any
     1051*          iteration information already present in the UFieldPositionIterator
     1052*          will be deleted, and the iterator will be reset to apply to the
     1053*          fields in the formatted string created by this function call; the
     1054*          field values provided by {@link #ufieldpositer_next} will be from the
     1055*          UDateFormatField enum.
     1056* @param status
     1057*          A pointer to a UErrorCode to receive any errors
     1058* @return
     1059*          The total buffer size needed; if greater than resultLength, the output was truncated.
     1060* @see udat_format
     1061* @see udat_parseCalendar
     1062* @see UFieldPositionIterator
     1063* @draft ICU 55
     1064*/
     1065U_DRAFT int32_t U_EXPORT2
     1066udat_formatCalendarForFields( const UDateFormat* format,
     1067                        UCalendar*      calendar,
     1068                        UChar*          result,
     1069                        int32_t         capacity,
     1070                        UFieldPositionIterator* fpositer,
     1071                        UErrorCode*     status);
     1072
     1073#endif  /* U_HIDE_DRAFT_API */
    9481074
    9491075/**
     
    10701196udat_getNumberFormat(const UDateFormat* fmt);
    10711197
     1198#ifndef U_HIDE_DRAFT_API
     1199/**
     1200* Get the UNumberFormat for specific field associated with an UDateFormat.
     1201* For example: 'y' for year and 'M' for month
     1202* @param fmt The formatter to query.
     1203* @param field the field to query
     1204* @return A pointer to the UNumberFormat used by fmt to format field numbers.
     1205* @see udat_setNumberFormatForField
     1206* @draft ICU 54
     1207*/
     1208U_DRAFT const UNumberFormat* U_EXPORT2
     1209udat_getNumberFormatForField(const UDateFormat* fmt, UChar field);
     1210
     1211/**
     1212* Set the UNumberFormat for specific field associated with an UDateFormat.
     1213* It can be a single field like: "y"(year) or "M"(month)
     1214* It can be several field combined together: "yM"(year and month)
     1215* Note:
     1216* 1 symbol field is enough for multiple symbol field (so "y" will override "yy", "yyy")
     1217* If the field is not numeric, then override has no effect (like "MMM" will use abbreviation, not numerical field)
     1218*
     1219* @param fields the fields to set
     1220* @param fmt The formatter to set.
     1221* @param numberFormatToSet A pointer to the UNumberFormat to be used by fmt to format numbers.
     1222* @param status error code passed around (memory allocation or invalid fields)
     1223* @see udat_getNumberFormatForField
     1224* @draft ICU 54
     1225*/
     1226U_DRAFT void U_EXPORT2
     1227udat_adoptNumberFormatForFields(  UDateFormat* fmt,
     1228                            const UChar* fields,
     1229                                  UNumberFormat*  numberFormatToSet,
     1230                                  UErrorCode* status);
     1231#endif  /* U_HIDE_DRAFT_API */
     1232
    10721233/**
    10731234* Set the UNumberFormat associated with an UDateFormat.
    10741235* A UDateFormat uses a UNumberFormat to format numbers within a date,
    10751236* for example the day number.
     1237* This method also clears per field NumberFormat instances previously
     1238* set by {@see udat_setNumberFormatForField}
    10761239* @param fmt The formatter to set.
    10771240* @param numberFormatToSet A pointer to the UNumberFormat to be used by fmt to format numbers.
    10781241* @see udat_getNumberFormat
     1242* @see udat_setNumberFormatForField
    10791243* @stable ICU 2.0
    10801244*/
     
    10821246udat_setNumberFormat(            UDateFormat*    fmt,
    10831247                        const   UNumberFormat*  numberFormatToSet);
     1248
     1249#ifndef U_HIDE_DRAFT_API
     1250/**
     1251* Adopt the UNumberFormat associated with an UDateFormat.
     1252* A UDateFormat uses a UNumberFormat to format numbers within a date,
     1253* for example the day number.
     1254* @param fmt The formatter to set.
     1255* @param numberFormatToAdopt A pointer to the UNumberFormat to be used by fmt to format numbers.
     1256* @see udat_getNumberFormat
     1257* @draft ICU 54
     1258*/
     1259U_DRAFT void U_EXPORT2
     1260udat_adoptNumberFormat(            UDateFormat*    fmt,
     1261                                   UNumberFormat*  numberFormatToAdopt);
     1262#endif  /* U_HIDE_DRAFT_API */
    10841263
    10851264/**
     
    12181397    UDAT_STANDALONE_QUARTERS,
    12191398    UDAT_STANDALONE_SHORT_QUARTERS,
    1220 #ifndef U_HIDE_DRAFT_API
    12211399    /**
    12221400     * The CLDR-style short weekday names, e.g. "Su", Mo", etc.
     
    12241402     * above, which actually get the CLDR-style *abbreviated* versions of the
    12251403     * corresponding names.
    1226      * @draft ICU 51
     1404     * @stable ICU 51
    12271405     */
    12281406    UDAT_SHORTER_WEEKDAYS,
    12291407    /**
    12301408     * Standalone version of UDAT_SHORTER_WEEKDAYS.
    1231      * @draft ICU 51
     1409     * @stable ICU 51
    12321410     */
    12331411    UDAT_STANDALONE_SHORTER_WEEKDAYS
     1412#ifndef U_HIDE_DRAFT_API
     1413    ,
     1414    /**
     1415     * Cyclic year names (only supported for some calendars, and only for FORMAT usage;
     1416     * udat_setSymbols not supported for UDAT_CYCLIC_YEARS_WIDE)
     1417     * @draft ICU 54
     1418     */
     1419    UDAT_CYCLIC_YEARS_WIDE,
     1420    /**
     1421     * Cyclic year names (only supported for some calendars, and only for FORMAT usage)
     1422     * @draft ICU 54
     1423     */
     1424    UDAT_CYCLIC_YEARS_ABBREVIATED,
     1425    /**
     1426     * Cyclic year names (only supported for some calendars, and only for FORMAT usage;
     1427     * udat_setSymbols not supported for UDAT_CYCLIC_YEARS_NARROW)
     1428     * @draft ICU 54
     1429     */
     1430    UDAT_CYCLIC_YEARS_NARROW,
     1431    /**
     1432     * Calendar zodiac  names (only supported for some calendars, and only for FORMAT usage;
     1433     * udat_setSymbols not supported for UDAT_ZODIAC_NAMES_WIDE)
     1434     * @draft ICU 54
     1435     */
     1436    UDAT_ZODIAC_NAMES_WIDE,
     1437    /**
     1438     * Calendar zodiac  names (only supported for some calendars, and only for FORMAT usage)
     1439     * @draft ICU 54
     1440     */
     1441    UDAT_ZODIAC_NAMES_ABBREVIATED,
     1442    /**
     1443     * Calendar zodiac  names (only supported for some calendars, and only for FORMAT usage;
     1444     * udat_setSymbols not supported for UDAT_ZODIAC_NAMES_NARROW)
     1445     * @draft ICU 54
     1446     */
     1447    UDAT_ZODIAC_NAMES_NARROW
    12341448#endif  /* U_HIDE_DRAFT_API */
    12351449} UDateFormatSymbolType;
     
    13191533                     UErrorCode* status);
    13201534
    1321 #ifndef U_HIDE_DRAFT_API
    13221535/**
    13231536 * Set a particular UDisplayContext value in the formatter, such as
     
    13261539 * @param value The UDisplayContext value to set.
    13271540 * @param status A pointer to an UErrorCode to receive any errors
    1328  * @draft ICU 51
     1541 * @stable ICU 51
    13291542 */
    13301543U_DRAFT void U_EXPORT2
     
    13381551 * @param status A pointer to an UErrorCode to receive any errors
    13391552 * @return The UDisplayContextValue for the specified type.
    1340  * @draft ICU 51
    1341  */
    1342 U_DRAFT UDisplayContext U_EXPORT2
    1343 udat_getContext(UDateFormat* fmt, UDisplayContextType type, UErrorCode* status);
    1344 
    1345 #endif  /* U_HIDE_DRAFT_API */
     1553 * @stable ICU 53
     1554 */
     1555U_STABLE UDisplayContext U_EXPORT2
     1556udat_getContext(const UDateFormat* fmt, UDisplayContextType type, UErrorCode* status);
    13461557
    13471558#ifndef U_HIDE_INTERNAL_API
  • trunk/Source/JavaScriptCore/icu/unicode/uvernum.h

    r196492 r215616  
    11/*
    22*******************************************************************************
    3 *   Copyright (C) 2000-2013, International Business Machines
     3*   Copyright (C) 2000-2015, International Business Machines
    44*   Corporation and others.  All Rights Reserved.
    55*******************************************************************************
     
    5252 */
    5353#define U_COPYRIGHT_STRING \
    54   " Copyright (C) 2013, International Business Machines Corporation and others. All Rights Reserved. "
     54  " Copyright (C) 2015, International Business Machines Corporation and others. All Rights Reserved. "
    5555
    5656/** The current ICU major version as an integer.
     
    5858 *  @stable ICU 2.4
    5959 */
    60 #define U_ICU_VERSION_MAJOR_NUM 52
     60#define U_ICU_VERSION_MAJOR_NUM 55
    6161
    6262/** The current ICU minor version as an integer.
     
    8484 *  @stable ICU 2.6
    8585 */
    86 #define U_ICU_VERSION_SUFFIX _52
     86#define U_ICU_VERSION_SUFFIX _55
    8787
    8888/**
     
    119119 *  @stable ICU 2.4
    120120 */
    121 #define U_ICU_VERSION "52.1"
     121#define U_ICU_VERSION "55.1"
    122122
    123123/** The current ICU library major/minor version as a string without dots, for library name suffixes.
     
    125125 *  @stable ICU 2.6
    126126 */
    127 #define U_ICU_VERSION_SHORT "52"
     127#define U_ICU_VERSION_SHORT "55"
    128128
    129129#ifndef U_HIDE_INTERNAL_API
     
    131131 * @internal ICU 4.4 Internal Use Only
    132132 **/
    133 #define U_ICU_DATA_VERSION "52.1"
     133#define U_ICU_DATA_VERSION "55.1"
    134134#endif  /* U_HIDE_INTERNAL_API */
    135135
     
    147147 * @stable ICU 2.4
    148148 */
    149 #define UCOL_RUNTIME_VERSION 7
     149#define UCOL_RUNTIME_VERSION 9
    150150
    151151/**
     
    156156 * @stable ICU 2.4
    157157 */
    158 #define UCOL_BUILDER_VERSION 8
     158#define UCOL_BUILDER_VERSION 9
    159159
     160#ifndef U_HIDE_DEPRECATED_API
    160161/**
    161  * This is the version of collation tailorings.
    162  * This value may change in subsequent releases of ICU.
    163  * @stable ICU 2.4
     162 * Constant 1.
     163 * This was intended to be the version of collation tailorings,
     164 * but instead the tailoring data carries a version number.
     165 * @deprecated ICU 54
    164166 */
    165167#define UCOL_TAILORINGS_VERSION 1
     168#endif  /* U_HIDE_DEPRECATED_API */
    166169
    167170#endif
  • trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h

    r215429 r215616  
    212212    macro(forEach) \
    213213    macro(formatMatcher) \
     214    macro(formatToParts) \
    214215    macro(forward) \
    215216    macro(frames) \
  • trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp

    r215526 r215616  
    4242#include <wtf/text/StringBuilder.h>
    4343
     44#if JSC_ICU_HAS_UFIELDPOSITER
     45#include <unicode/ufieldpositer.h>
     46#endif
     47
    4448namespace JSC {
    4549
     
    5559        udat_close(dateFormat);
    5660}
     61
     62#if JSC_ICU_HAS_UFIELDPOSITER
     63void IntlDateTimeFormat::UFieldPositionIteratorDeleter::operator()(UFieldPositionIterator* iterator) const
     64{
     65    if (iterator)
     66        ufieldpositer_close(iterator);
     67}
     68#endif
    5769
    5870IntlDateTimeFormat* IntlDateTimeFormat::create(VM& vm, Structure* structure)
     
    892904}
    893905
     906#if JSC_ICU_HAS_UFIELDPOSITER
     907const char* IntlDateTimeFormat::partTypeString(UDateFormatField field)
     908{
     909    switch (field) {
     910    case UDAT_ERA_FIELD:
     911        return "era";
     912    case UDAT_YEAR_FIELD:
     913    case UDAT_YEAR_NAME_FIELD:
     914    case UDAT_EXTENDED_YEAR_FIELD:
     915        return "year";
     916    case UDAT_MONTH_FIELD:
     917    case UDAT_STANDALONE_MONTH_FIELD:
     918        return "month";
     919    case UDAT_DATE_FIELD:
     920        return "day";
     921    case UDAT_HOUR_OF_DAY1_FIELD:
     922    case UDAT_HOUR_OF_DAY0_FIELD:
     923    case UDAT_HOUR1_FIELD:
     924    case UDAT_HOUR0_FIELD:
     925        return "hour";
     926    case UDAT_MINUTE_FIELD:
     927        return "minute";
     928    case UDAT_SECOND_FIELD:
     929    case UDAT_FRACTIONAL_SECOND_FIELD:
     930        return "second";
     931    case UDAT_DAY_OF_WEEK_FIELD:
     932    case UDAT_DOW_LOCAL_FIELD:
     933    case UDAT_STANDALONE_DAY_FIELD:
     934        return "weekday";
     935    case UDAT_AM_PM_FIELD:
     936        return "dayPeriod";
     937    case UDAT_TIMEZONE_FIELD:
     938    case UDAT_TIMEZONE_RFC_FIELD:
     939    case UDAT_TIMEZONE_GENERIC_FIELD:
     940    case UDAT_TIMEZONE_SPECIAL_FIELD:
     941    case UDAT_TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD:
     942    case UDAT_TIMEZONE_ISO_FIELD:
     943    case UDAT_TIMEZONE_ISO_LOCAL_FIELD:
     944        return "timeZoneName";
     945    // These should not show up because there is no way to specify them in DateTimeFormat options.
     946    // If they do, they don't fit well into any of known part types, so consider it a "literal".
     947    case UDAT_DAY_OF_YEAR_FIELD:
     948    case UDAT_DAY_OF_WEEK_IN_MONTH_FIELD:
     949    case UDAT_WEEK_OF_YEAR_FIELD:
     950    case UDAT_WEEK_OF_MONTH_FIELD:
     951    case UDAT_YEAR_WOY_FIELD:
     952    case UDAT_JULIAN_DAY_FIELD:
     953    case UDAT_MILLISECONDS_IN_DAY_FIELD:
     954    case UDAT_QUARTER_FIELD:
     955    case UDAT_STANDALONE_QUARTER_FIELD:
     956    case UDAT_RELATED_YEAR_FIELD:
     957    case UDAT_TIME_SEPARATOR_FIELD:
     958    case UDAT_FIELD_COUNT:
     959        return "literal";
     960    }
     961    // Any newer additions to the UDateFormatField enum should just be considered a "literal" part.
     962    return "literal";
     963}
     964
     965
     966JSValue IntlDateTimeFormat::formatToParts(ExecState& exec, double value)
     967{
     968    VM& vm = exec.vm();
     969    auto scope = DECLARE_THROW_SCOPE(vm);
     970
     971    // 12.1.8 FormatDateTimeToParts (ECMA-402 4.0)
     972    // https://tc39.github.io/ecma402/#sec-formatdatetimetoparts
     973
     974    if (!std::isfinite(value))
     975        return throwRangeError(&exec, scope, ASCIILiteral("date value is not finite in DateTimeFormat formatToParts()"));
     976
     977    UErrorCode status = U_ZERO_ERROR;
     978    auto fields = std::unique_ptr<UFieldPositionIterator, UFieldPositionIteratorDeleter>(ufieldpositer_open(&status));
     979    if (U_FAILURE(status))
     980        return throwTypeError(&exec, scope, ASCIILiteral("failed to open field position iterator"));
     981
     982    status = U_ZERO_ERROR;
     983    Vector<UChar, 32> result(32);
     984    auto resultLength = udat_formatForFields(m_dateFormat.get(), value, result.data(), result.size(), fields.get(), &status);
     985    if (status == U_BUFFER_OVERFLOW_ERROR) {
     986        status = U_ZERO_ERROR;
     987        result.grow(resultLength);
     988        udat_formatForFields(m_dateFormat.get(), value, result.data(), resultLength, fields.get(), &status);
     989    }
     990    if (U_FAILURE(status))
     991        return throwTypeError(&exec, scope, ASCIILiteral("failed to format date value"));
     992
     993    JSGlobalObject* globalObject = exec.jsCallee()->globalObject();
     994    JSArray* parts = JSArray::tryCreate(vm, globalObject->arrayStructureForIndexingTypeDuringAllocation(ArrayWithContiguous), 0);
     995    if (!parts)
     996        return throwOutOfMemoryError(&exec, scope);
     997
     998    auto resultString = String(result.data(), resultLength);
     999    auto typePropertyName = Identifier::fromString(&vm, "type");
     1000    auto literalString = jsString(&exec, ASCIILiteral("literal"));
     1001
     1002    int32_t previousEndIndex = 0;
     1003    int32_t beginIndex = 0;
     1004    int32_t endIndex = 0;
     1005    while (previousEndIndex < resultLength) {
     1006        auto fieldType = ufieldpositer_next(fields.get(), &beginIndex, &endIndex);
     1007        if (fieldType < 0)
     1008            beginIndex = endIndex = resultLength;
     1009
     1010        if (previousEndIndex < beginIndex) {
     1011            auto value = jsString(&exec, resultString.substring(previousEndIndex, beginIndex - previousEndIndex));
     1012            JSObject* part = constructEmptyObject(&exec);
     1013            part->putDirect(vm, typePropertyName, literalString);
     1014            part->putDirect(vm, vm.propertyNames->value, value);
     1015            parts->push(&exec, part);
     1016        }
     1017        previousEndIndex = endIndex;
     1018
     1019        if (fieldType >= 0) {
     1020            auto type = jsString(&exec, partTypeString(UDateFormatField(fieldType)));
     1021            auto value = jsString(&exec, resultString.substring(beginIndex, endIndex - beginIndex));
     1022            JSObject* part = constructEmptyObject(&exec);
     1023            part->putDirect(vm, typePropertyName, type);
     1024            part->putDirect(vm, vm.propertyNames->value, value);
     1025            parts->push(&exec, part);
     1026        }
     1027    }
     1028
     1029
     1030    return parts;
     1031}
     1032#endif
     1033
    8941034} // namespace JSC
    8951035
  • trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormat.h

    r215526 r215616  
    3030#include "JSDestructibleObject.h"
    3131#include <unicode/udat.h>
     32#include <unicode/uvernum.h>
     33
     34#if U_ICU_VERSION_MAJOR_NUM >= 55
     35#define JSC_ICU_HAS_UFIELDPOSITER 1
     36#endif
    3237
    3338namespace JSC {
     
    4752    void initializeDateTimeFormat(ExecState&, JSValue locales, JSValue options);
    4853    JSValue format(ExecState&, double value);
     54#if JSC_ICU_HAS_UFIELDPOSITER
     55    JSValue formatToParts(ExecState&, double value);
     56#endif
    4957    JSObject* resolvedOptions(ExecState&);
    5058
     
    102110    Second m_second { Second::None };
    103111    TimeZoneName m_timeZoneName { TimeZoneName::None };
     112
     113#if JSC_ICU_HAS_UFIELDPOSITER
     114    struct UFieldPositionIteratorDeleter {
     115        void operator()(UFieldPositionIterator*) const;
     116    };
     117
     118    static const char* partTypeString(UDateFormatField);
     119#endif
    104120};
    105121
  • trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormatPrototype.cpp

    r215526 r215616  
    4242
    4343static EncodedJSValue JSC_HOST_CALL IntlDateTimeFormatPrototypeGetterFormat(ExecState*);
     44#if JSC_ICU_HAS_UFIELDPOSITER
     45static EncodedJSValue JSC_HOST_CALL IntlDateTimeFormatPrototypeFuncFormatToParts(ExecState*);
     46#endif
    4447static EncodedJSValue JSC_HOST_CALL IntlDateTimeFormatPrototypeFuncResolvedOptions(ExecState*);
    4548
     
    5962*/
    6063
    61 IntlDateTimeFormatPrototype* IntlDateTimeFormatPrototype::create(VM& vm, JSGlobalObject*, Structure* structure)
     64IntlDateTimeFormatPrototype* IntlDateTimeFormatPrototype::create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
    6265{
    6366    IntlDateTimeFormatPrototype* object = new (NotNull, allocateCell<IntlDateTimeFormatPrototype>(vm.heap)) IntlDateTimeFormatPrototype(vm, structure);
    64     object->finishCreation(vm, structure);
     67    object->finishCreation(vm, globalObject, structure);
    6568    return object;
    6669}
     
    7679}
    7780
    78 void IntlDateTimeFormatPrototype::finishCreation(VM& vm, Structure*)
     81void IntlDateTimeFormatPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject, Structure*)
    7982{
    8083    Base::finishCreation(vm);
     84#if JSC_ICU_HAS_UFIELDPOSITER
     85    JSFunction* formatToPartsFunction = JSFunction::create(vm, globalObject, 0, vm.propertyNames->formatToParts.string(), IntlDateTimeFormatPrototypeFuncFormatToParts);
     86    putDirectWithoutTransition(vm, vm.propertyNames->formatToParts, formatToPartsFunction, DontEnum);
     87#else
     88    UNUSED_PARAM(globalObject);
     89#endif
    8190}
    8291
     
    148157}
    149158
     159#if JSC_ICU_HAS_UFIELDPOSITER
     160EncodedJSValue JSC_HOST_CALL IntlDateTimeFormatPrototypeFuncFormatToParts(ExecState* state)
     161{
     162    VM& vm = state->vm();
     163    auto scope = DECLARE_THROW_SCOPE(vm);
     164
     165    // 15.4 Intl.DateTimeFormat.prototype.formatToParts (ECMA-402 4.0)
     166    // https://tc39.github.io/ecma402/#sec-Intl.DateTimeFormat.prototype.formatToParts
     167
     168    IntlDateTimeFormat* dateTimeFormat = jsDynamicCast<IntlDateTimeFormat*>(vm, state->thisValue());
     169    if (!dateTimeFormat)
     170        return JSValue::encode(throwTypeError(state, scope, ASCIILiteral("Intl.DateTimeFormat.prototype.formatToParts called on value that's not an object initialized as a DateTimeFormat")));
     171
     172    JSValue date = state->argument(0);
     173    double value;
     174
     175    if (date.isUndefined())
     176        value = JSValue::decode(dateNow(state)).toNumber(state);
     177    else {
     178        value = date.toNumber(state);
     179        RETURN_IF_EXCEPTION(scope, encodedJSValue());
     180    }
     181
     182    scope.release();
     183    return JSValue::encode(dateTimeFormat->formatToParts(*state, value));
     184}
     185#endif
     186
    150187EncodedJSValue JSC_HOST_CALL IntlDateTimeFormatPrototypeFuncResolvedOptions(ExecState* state)
    151188{
  • trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormatPrototype.h

    r215349 r215616  
    4444
    4545protected:
    46     void finishCreation(VM&, Structure*);
     46    void finishCreation(VM&, JSGlobalObject*, Structure*);
    4747
    4848private:
Note: See TracChangeset for help on using the changeset viewer.