Intent to ship Intl.DateTimeFormat.protoytpe.formatToParts

31 views
Skip to first unread message

Jungshik Shin (신정식, 申政湜)

unread,
Dec 16, 2016, 5:57:50 PM12/16/16
to v8-u...@googlegroups.com
js...@chromium.org https://github.com/tc39/ecma402/files/41759/formatToParts.pdf Intl.DateTimeFormat.prototype.formatToParts() is scheduled to be added to the EcmaScript Internationalization API specification (Ecma 402). It adds a method to format date and time to a list of tokens and their type (e.g. literal, day, year, month, hour, minute, era, etc). It's implemented and shipped by Firefox. v8 implemented it behind a flag.
Formatting different parts of a DateTime string in different styles (font weight, size, color, etc) is not possible currently because DateTimeFormat does not offer a way to access individual parts of formatted DateTime. This API gives back a list of token types and their offsets making it possible to style different parts differently in an i18n-aware manner. See https://github.com/tc39/ecma402/issues/30  Firefox: Shipped Edge: No public signals Safari: No public signals Web developers: No signals

None. This is a new API. None Yes https://bugs.chromium.org/p/v8/issues/detail?id=5244 https://www.chromestatus.com/features/6319456309477376 Yes

Jungshik Shin (신정식, 申政湜)

unread,
Dec 16, 2016, 6:01:01 PM12/16/16
to v8-u...@googlegroups.com, v8-...@googlegroups.com
Cross-posting to v8-dev@

Contact emails
js...@chromium.org
Spec

https://github.com/tc39/ecma402/files/41759/formatToParts.pdf

Summary

Intl.DateTimeFormat.prototype.formatToParts() is scheduled to be added to the EcmaScript Internationalization API specification (Ecma 402).
It adds a method to format date and time to a list of tokens and their type (e.g. literal, day, year, month, hour, minute, era, etc).
It's implemented and shipped by Firefox. v8 implemented it behind a flag.

Motivation

Formatting different parts of a DateTime string in different styles (font weight, size, color, etc) is not possible currently because DateTimeFormat does not offer a way to access individual parts of formatted DateTime. This API gives back a list of token types and their offsets making it possible to style different parts differently in an i18n-aware manner. See https://github.com/tc39/ecma402/issues/30 
Interoperability risk

Firefox: Shipped
Safari: No public signals
Web developers: No signals
Edge: No public signals

Daniel Ehrenberg

unread,
Dec 16, 2016, 6:38:35 PM12/16/16
to v8-...@googlegroups.com, v8-users
LGTM
> --
> --
> v8-dev mailing list
> v8-...@googlegroups.com
> http://groups.google.com/group/v8-dev
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-dev+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Adam Klein

unread,
Dec 19, 2016, 3:41:53 PM12/19/16
to v8-users, v8-...@googlegroups.com
LGTM2

> For more options, visit https://groups.google.com/d/optout.

--
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups "v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages