Hi,
We have an encountered an issue with Date parsing when using standard ICU date formats.
Salesforce allow you to access Internationalization properties which are localised with respect to the locale of the current user (a user level setting rather than a device setting). We are using this with the LocaleManager to set the localised parsers on DateHelper. https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.create_i18n
As an example, we can do the following: import L from '@salesforce/i18n/dateTime.shortDateFormat';
and then use this value to localize the DateHelper L parser.
Salesforce are using ICU Date Formats - so for a user with a locale of English (United States), the value of L above is M/d/yyyy
. However, this date format is incompatible with DateHelper.parse(). I've attached a screenshot showing the outcome if this format is used.
Is there a reason why the accepted tokens to the DateHelper.parse()
method differ from the standard ICU formats? Is there any work planned to support the ICU formats? If not, I suppose we will need to apply an additional conversion between the ICU format and the accepted format.
Many thanks!