Localization provider

Release candidate

The LocalizationProvider component is essential for configuring the locale and date adapter in components that utilize date objects.

Also known as: Provider
Note: This tab list includes overflow; tab positions may be inaccurate or change when a tab is selected

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.

  • Day.js: Recommended for its small footprint, this library returns immutable Day.js objects.
  • date-fns: Ideal for comprehensive date manipulation, it returns native JavaScript Date objects but does not support timezones or UTC.
  • Luxon: A modern successor to Moment.js, it returns Luxon objects.
  • Moment.js: A legacy library that is no longer actively maintained.

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).