Browse project documentation

Installation and package entry points

Intl Datepickerv0.4.2View sourceEnglish / Persian

Load the custom element and only the calendars, labels, or React wrapper you need.

Install in an application

npm install intl-datepicker
import 'intl-datepicker';

This side-effect import registers intl-datepicker in browsers. Include it in your client entry before using the element API. Bare package imports need a bundler or an import map; a browser cannot resolve them in an ordinary HTML file by itself. The package exports ES modules and includes TypeScript declarations.

The stylesheet is embedded in the shadow root. There is no public CSS subpath to import. @internationalized/date is a package dependency; React is an optional peer needed only for the wrapper.

Entry points

ImportRegisters or provides
intl-datepickerElement, Gregorian calendar, English labels
intl-datepicker/fullElement, all registered calendars, English/Persian/Arabic/Hebrew labels
intl-datepicker/calendars/persianpersian
intl-datepicker/calendars/islamicislamic, islamic-umalqura, islamic-civil, islamic-tbla
intl-datepicker/calendars/hebrewhebrew
intl-datepicker/calendars/buddhistbuddhist
intl-datepicker/calendars/japanesejapanese
intl-datepicker/calendars/indianindian
intl-datepicker/calendars/ethiopicethiopic, ethioaa
intl-datepicker/calendars/copticcoptic
intl-datepicker/calendars/rocroc
intl-datepicker/labels/faPersian interface labels
intl-datepicker/labels/arArabic interface labels
intl-datepicker/labels/heHebrew interface labels
intl-datepicker/reactReact wrapper, which also imports the base element

Calendar and label entry points export no values; import them for registration. There are no public /calendars/all or /labels/all subpaths. Use /full when you deliberately want everything.

Load Persian only

import 'intl-datepicker/calendars/persian';
import 'intl-datepicker/labels/fa';
import 'intl-datepicker';
<intl-datepicker calendar="persian" locale="fa-IR"
  value="2024-03-20"></intl-datepicker>

This selects the first day of Persian year 1403, while value remains 2024-03-20. Import calendar and label modules before the base element import when markup already exists, as above; importing a label set later does not automatically refresh existing instances. An unregistered calendar warns and falls back to Gregorian.

Without a bundler

For a standalone HTML file, an ESM CDN can resolve the package dependencies:

<script type="module">
  import 'https://esm.sh/intl-datepicker@0.4.2/calendars/persian';
  import 'https://esm.sh/intl-datepicker@0.4.2/labels/fa';
  import 'https://esm.sh/intl-datepicker@0.4.2';
</script>
<intl-datepicker calendar="persian" locale="fa-IR"
  value="2024-03-20"></intl-datepicker>

The pinned version must contain the APIs you use. CDN delivery needs network access and depends on that service; the repository build is not a self-contained classic script. For /full, replace those imports with https://esm.sh/intl-datepicker@0.4.2/full.

Browser and server requirements

The interactive component needs custom elements, Shadow DOM, JavaScript modules, and Intl support for the chosen calendar. Native submission and validity depend on form-associated custom elements and ElementInternals; no hidden-input fallback is provided when these are unavailable.

The build targets ES2022. The popup uses the Popover API when available and otherwise uses fixed positioning. Without Popover, transformed ancestors and clipping containers can affect placement. Adopted stylesheets have a style-element fallback. These fallbacks are not a tested minimum-browser-version guarantee.

The repository has browser tests for Chromium, Firefox, and WebKit. Check the browsers and assistive technologies required by your application. See frameworks and SSR for the difference between safe server imports and client rendering.

Search documentation

Search across all projects. Close this window to return to your guide.

Tab to navigate · Enter to openEsc to close