Skip to main content

Setup Options

These options are the properties that can be passed to the datepicker to customize its behavior.

className

Typestring

Add custom classes.

dateFormat

TypestringDefaultYYYY-MM-DD

Get the formatted date according to the string passed in.

If you want to pass escape characters, you can use square brackets to wrap the text. (e.g. YYYY [escaped text] MM will output 2024 escaped text 01)

  • YY - 2-digit year
  • YY1 - 2-digit year of the first year in current decade
  • YY2 - 2-digit year of the last year in current decade
  • YYYY - full year
  • YYYY1 - full year of the first year in current decade
  • YYYY2 - full year of the last year in current decade
  • M - month
  • MM - month with leading zero
  • MMM - short month name
  • MMMM - full month name
  • D - day
  • DD - day with leading zero
  • d - weekday index
  • dd - min weekday name
  • ddd - short weekday name
  • dddd - full weekday name

locale

TypeLocale

Language of the calendar. By default, english language is used.

interface Locale {
name: string;
months: string[];
monthsShort: string[];
weekStart?: number;
weekdays: string[];
weekdaysShort: string[];
weekdaysMin: string[];
formats: { time: string; date: string };
placeholder?: string;
}

inline

TypebooleanDefaultfalse

Makes the calendar to be permanently visible.

selectedDate

TypeDate

The active date.

minDate

TypeDate

The minimum date of calendar, Can't be set to less than 0100-01-01

maxDate

TypeDate

The maximum date of calendar, Can't be set to more than 9999-12-31

view

TypeDateDefaultdays

The initial view of the calendar. (e.g. days | months | years)

minView

TypeDateDefaultdays

The minimum view of the calendar. The values are same as view.

showOtherMonths

TypebooleanDefaulttrue

If true, dates from other months will be displayed in days view.

selectOtherMonths

TypebooleanDefaulttrue

If true, it will be possible to select dates from other months.

moveOtherMonths

TypebooleanDefaulttrue

If true , then selecting dates from another month will be causing transition to this month.

shortcuts

TypebooleanDefaulttrue

Enables keyboard navigation.

Move cell focus.

CommandDescription
Move cell focus.
Ctrl + or Move to the next month
Ctrl + or Move to the previous month
Shift + or Move to the next month
Shift + or Move to the previous month
Alt + or Move to the next month
Alt + or Move to the previous month
TypebooleanDefaulttrue

Whether to enable navigation when the maximum/minimum date is exceeded.

autoClose

TypebooleanDefaulttrue

If true, the calendar will be hidden after selecting the date.

toggleSelected

TypebooleanDefaulttrue

If true, then clicking on the active cell will remove the selection from it.

titleFormat

TypeTitleFormatDefault{ days: 'MMMM, <i>YYYY</i>', months: 'YYYY', years: 'YYYY1 - YYYY2' }

Title templates in the calendar navigation.

interface TitleFormat {
days: string;
months: string;
years: string;
}

position

TypestringDefaultbottom-start

Position of the calendar relative to the input field.

  • top | top-start | top-end
  • bottom | bottom-start | bottom-end
  • right | right-start | right-end
  • left | left-start | left-end

animation

TypebooleanDefaulttrue

If true, the calendar will open & close with animation.

backdrop

TypebooleanDefaultfalse

If true, calendar apper with backdrop

readOnly

TypebooleanDefaultfalse

If true, it will not be able to edit dates at input field.

placeHolder

Typestring

Datepicker placeholder

theme

Typelight | darkDefaultlight

If, dark, datepicker's color scheme set to dark mode

size

Typesmall | normalDefaultnormal

The size of datepicker input.

buttons

TypeButtonPresetType | ButtonPresetType[] | ButtonOptions | ButtonOptions[]

Add action buttons to the calendar. You could add two pre defined buttons or custom buttons.

ButtonPresetType

  • clear: add "Clear" button. Clear the selected date
  • today: add "Today" button. Set the selected date to today

ButtonOptions

interface ButtonPresetOptions {
id?: string; // button id
className?: string; // button class
dataset?: Record<string, string>; // button data attributes
attrs?: Record<string, string>; // button attributes
innerHTML?: string; // button inner html
onClick?: (event: MouseEvent, datepicker: SnowDatePicker) => any; // button click event
}
```import { escape } from 'core-js/fn/regexp';