Skip to main content

DatePicker

v.7.0.4

Installation

yarn add @mercell/date-picker-react

Usage

Using the Date Picker component is as simple as importing it like this.

import { DatePicker } from '@mercell/date-picker-react';
// if you need additional languages to pass into locale property
import { nb, fr } from 'date-fns/locale';
Live Editor
Result

Types, definitions, etc.

DatePickerProps
interface DatePickerProps extends Partial<ReactDatePickerProps> {
onChange: (date: Date) => void;
locale?: Locale;
invalid?: boolean;

}
NameTypeDefaultRequiredDescription
onChange(date: string) => void;-yesCallback with selected date, triggered on onChange inside picker
localeLocaleenGBnoPart of date-fns library, you can specify different languages do date picker
invalidbooleanfalsenoBoolean value to show that there is an error in datepicker

Rest possible props you can find in the documentation of react-datepicker by HackerOne