Calendar options

useCalendar hook gets an object of type CalendarOptions - this allows you to set your desired configuration and behavior. Each of the options has its default (see below) and you can call the hook without the options object.

useCalendar({
  startMonth: 1, // January
  startYear: 2024,
  numberOfDisplayedMonths: 1,
  isRangePicker: false,
  minDate: undefined,
  maxDate: undefined,
  allowFuture: true,
  allowPast: true,
  locale: 'en'
});
Parameter
Description
Type
Default
startMonth

The month to start from

number

today's month

startYear

The year to start from

number

today's year

numberOfDisplayedMonths

Number of months that are displayed to the user to select from

number

1

isRangePicker

Wether the calendar instance is a range picker, allowing the user to select 2 dates representing a range

boolean

false

minDate

The minimal date that can be selected by the user

Date

undefined

maxDate

The maximum date that can be selected by the user

Date

undefined

allowFuture

Should the user be allowed to choose future dates.

boolean

true

allowPast

Should the user be allowed to choose past dates.

boolean

true

locale

The locale to be used

string

en

Last updated