Localization provider

LocalizationProvider configures the locale and date adapter for components with date objects.

Also known as: Provider
Salt package@salt-ds/date-components

For the purpose of the examples, we use type DateFrameworkType so the examples can be used across all date adapters. For your own code you can replace this type with the type of your date object (e.g luxon would be DateTime).

To integrate your date framework with Salt components and enable support for locales or timezones, defining a date adapter is essential. Salt provides date adapters for the most popular date frameworks, which you can extend or use as a foundation to create your own custom adapter.

  • luxon: A modern successor to Moment.js, it returns Luxon objects
    • Recommended for all J.P. Morgan use-cases.
  • moment.js: A legacy library that is no longer actively maintained.
    • Provided to assist J.P.Morgan migration from Moment to Luxon.
  • date-fns: Ideal for comprehensive date manipulation, it returns native JavaScript Date objects.
    • Slower than Luxon.
  • day.js: Small footprint, this library returns immutable Day.js objects.
    • Slowest of the 4 choices.

Use LocalizationProvider to change the min/max dates for the date adapter. These represent the fallback dates when no min/max date is provided by the component.

In this example, date selection is limited to 3 months.

The LocalizationProvider defines the locale used by Salt's date based controls such as Calendar, DateInput and DatePicker.

Configuration of locales is date framework specific and may require you to import specific locales from the date library you are using.

By default, Salt defaults to the "enUS" locale (or equivalent).