daterly

Locales & formats

Defaults: locale = ru, dateFormat = 'dd.MM.yyyy'. Any date-fns locale is plugged in with a single prop — the input mask, placeholder, and parsing are recalculated automatically.

Example: en-US

import { enUS } from 'date-fns/locale'
import { DatePicker } from 'daterly'

<DatePicker
  locale={enUS}
  dateFormat="MM/dd/yyyy"
  label="Birth date"
/>

Input mask: __/__/____. Placeholder: mm/dd/yyyy. The calendar is in English.

Example: ISO

import { enUS } from 'date-fns/locale'

<DatePicker
  locale={enUS}
  dateFormat="yyyy-MM-dd"
  label="ISO date"
/>

Mask: ____-__-__. Placeholder: yyyy-mm-dd.

Example: German

import { de } from 'date-fns/locale'

<DatePicker locale={de} dateFormat="dd.MM.yyyy" label="Geburtsdatum" />

Supported dateFormat tokens

TokenMeaning
ddDay, 2 digits
MMMonth, 2 digits
yyyyYear, 4 digits

All three must be present in the format exactly once each. Any single character is accepted as a separator (., /, -, ).

Time is set via the separate showTime prop, not through dateFormat. Passing HH, mm, or ss in dateFormat raises an error.

Placeholder

  • For locale.code === 'ru' — Russian letters: дд.мм.гггг, чч:мм.
  • For other locales — Latin letters: dd.mm.yyyy, hh:mm.

You can override it with the placeholder prop:

<DatePicker placeholder="Select a date..." />

List of locales

All date-fns locales are imported from date-fns/locale:

import { ru, enUS, enGB, de, fr, es, it, ja, ko, zhCN } from 'date-fns/locale'

See the full list on the date-fns site.

On this page