Token Changes for Formatting Dates in JavaScript API Methods

To improve performance and simplify the code, we changed the supported tokens for formatting dates in JavaScript API methods, such as formatDate(), in the AuraLocalizationService object.

Where: This change applies to orgs with Lightning components in Lightning Experience, Salesforce Classic, and all versions of the Salesforce app.

Removed Token

The W token, which returned week of year, is no longer supported. We still support the w (lowercase) token, which also returns the week of the year (0 ... 53).

Deprecated Tokens

Description Deprecated Token Preferred Token Output
Year (four digits) y yyyy 2018
Year (four digits) Y yyyy 2018
Year (two digits) YY yy 18
Year (four digits) YYYY yyyy 2018
AM or PM A a AM or PM
Day of month DD dd 01–31

For more information on formatting dates in JavaScript, see Formatting Dates in JavaScript.