← Back to release summary

fractionalSecondDigits option for Intl.DateTimeFormat

Category
JavaScript
Type
New or changed feature
Status
Enabled by default (Chrome 84)
Intent stage
Prepare to ship

WPT details: Tests are added to test262 ./test/intl402/DateTimeFormat/constructor-options-fractionalSecondDigits-invalid.js ./test/intl402/DateTimeFormat/constructor-options-throwing-getters-fractionalSecondDigits.js ./test/intl402/DateTimeFormat/taint-Object-prototype-fractionalSecondDigits.js ./test/intl402/DateTimeFormat/constructor-options-order-fractionalSecondDigits.js ./test/intl402/DateTimeFormat/constructor-options-fractionalSecondDigits-valid.js ./test/intl402/DateTimeFormat/prototype/formatRangeToParts/fractionalSecondDigits.js ./test/intl402/DateTimeFormat/prototype/resolvedOptions/order-fractionalSecondDigits.js ./test/intl402/DateTimeFormat/prototype/format/fractionalSecondDigits.js ./test/intl402/DateTimeFormat/prototype/formatRange/fractionalSecondDigits.js ./test/intl402/DateTimeFormat/prototype/formatToParts/fractionalSecondDigits.js

Summary

Enhances the Intl.DateTimeFormat API by adding a “ fractionalSecondDigits” option to control the format of fractions of a second.

Motivation

The Date object in ECMAScript stores time information with millisecond precision. Some web developers need to output milliseconds. This option enhances Intl.DateTimeFormat to control formatting of fractions of second. The value of millisecondDigits should be an integer between 0 to 3 to represent how many digits the DateTimeFormat should output after the decimal mark.

Standards & signals

Ecosystem

Docs: https://docs.google.com/document/d/1KXbFOzTsfIHXhk0uw8p8WXIHZ1Bm1xMZXahtDOiK40Q/edit#

Samples: https://docs.google.com/document/d/1KXbFOzTsfIHXhk0uw8p8WXIHZ1Bm1xMZXahtDOiK40Q/edit#

Explainers: https://docs.google.com/document/d/1KXbFOzTsfIHXhk0uw8p8WXIHZ1Bm1xMZXahtDOiK40Q/edit#

View on chromestatus.com