Events & Hooks

    Each function added to a hook will receive 3 arguments when called. These are:

    • selectedDates - an array of Date objects selected by the user. When there are no dates selected, the array is empty.

    • - the flatpickr object, containing various methods and properties.

    Hooks

    onChange gets triggered when the user selects a date, or changes the time on a selected date.

    onOpen

    onOpen gets triggered when the calendar is opened.

    onClose gets triggered when the calendar is closed.

    onMonthChange

    onYearChange gets triggered when the year is changed, either by the user or programmatically.

    onReady

    onReady gets triggered once the calendar is in a ready state.

    onValueUpdate gets triggered when the input value is updated with a new date string.

    onDayCreate

    Take full control of every date cell with theonDayCreate()hook.