These libraries provide date and time selection interfaces for React applications, but they serve different platforms and user experience goals. The web-focused packages (react-calendar, react-datepicker, react-datetime) render HTML-based calendars and inputs for browsers. The native-focused packages (react-native-date-picker, react-native-datepicker, react-native-modal-datetime-picker) wrap iOS and Android system pickers for mobile apps. Choosing the right tool depends on whether you are building for the web or mobile, and whether you need a custom design or native consistency.
Selecting a date picker library is not just about picking a component ā it is about choosing between web standards and native mobile experiences. The six packages listed here split cleanly into two groups: web browsers and React Native mobile apps. Mixing them up will break your build, so understanding the platform target is the first architectural decision. Let's compare how they handle implementation, state, and maintenance.
Web packages differ in whether they render a standalone calendar or an input field with a dropdown.
react-calendar renders a visible calendar grid. You must manage the visibility toggle yourself.
// react-calendar: Standalone view
import Calendar from 'react-calendar';
function App() {
const [date, setDate] = useState(new Date());
return <Calendar onChange={setDate} value={date} />;
}
react-datepicker renders an input field that shows a calendar on click.
// react-datepicker: Input with dropdown
import DatePicker from 'react-datepicker';
function App() {
const [date, setDate] = useState(new Date());
return <DatePicker selected={date} onChange={setDate} />;
}
react-datetime renders an input field with a more complex dropdown supporting time.
// react-datetime: Input with time support
import Datetime from 'react-datetime';
function App() {
const [date, setDate] = useState(new Date());
return <Datetime value={date} onChange={setDate} />;
}
react-native-date-picker renders a native mobile picker (iOS/Android).
// react-native-date-picker: Native mobile view
import DatePicker from 'react-native-date-picker';
function App() {
const [date, setDate] = useState(new Date());
return <DatePicker date={date} onDateChange={setDate} />;
}
react-native-datepicker renders a legacy native picker (Deprecated).
// react-native-datepicker: Legacy native view
import DatePicker from 'react-native-datepicker';
function App() {
const [date, setDate] = useState(new Date());
return <DatePicker date={date} onDateChange={setDate} />;
}
react-native-modal-datetime-picker renders a native picker inside a modal.
// react-native-modal-datetime-picker: Native modal
import DateTimePickerModal from 'react-native-modal-datetime-picker';
function App() {
const [visible, setVisible] = useState(false);
const [date, setDate] = useState(new Date());
return (
<DateTimePickerModal
isVisible={visible}
onConfirm={setDate}
onHide={() => setVisible(false)}
/>
);
}
All these libraries support controlled components, but the prop names differ slightly. Using controlled state ensures your form data stays in sync with React state.
react-calendar uses value and onChange.
// react-calendar: Controlled
<Calendar value={selectedDate} onChange={setSelectedDate} />
react-datepicker uses selected and onChange.
// react-datepicker: Controlled
<DatePicker selected={selectedDate} onChange={setSelectedDate} />
react-datetime uses value and onChange.
// react-datetime: Controlled
<Datetime value={selectedDate} onChange={setSelectedDate} />
react-native-date-picker uses date and onDateChange.
// react-native-date-picker: Controlled
<DatePicker date={selectedDate} onDateChange={setSelectedDate} />
react-native-datepicker uses date and onDateChange.
// react-native-datepicker: Controlled
<DatePicker date={selectedDate} onDateChange={setSelectedDate} />
react-native-modal-datetime-picker uses date (optional) and onConfirm.
// react-native-modal-datetime-picker: Controlled
<DateTimePickerModal date={selectedDate} onConfirm={setSelectedDate} />
Web libraries allow CSS overrides, while native libraries rely on system themes or modal props.
react-calendar uses class names for deep CSS targeting.
/* react-calendar: CSS Modules */
.react-calendar__tile--active { background: #0066cc; }
react-datepicker uses custom class names via props.
// react-datepicker: Custom class
<DatePicker className="custom-input" calendarClassName="custom-calendar" />
react-datetime uses inline styles or CSS classes.
// react-datetime: Custom input props
<Datetime inputProps={{ className: "custom-input" }} />
react-native-date-picker uses limited style props (native UI).
// react-native-date-picker: Limited styling
<DatePicker style={{ width: 300 }} textColor="white" />
react-native-datepicker uses style props (legacy).
// react-native-datepicker: Limited styling
<DatePicker style={{ width: 300 }} customStyles={{ ... }} />
react-native-modal-datetime-picker uses theme props for the modal.
// react-native-modal-datetime-picker: Theme props
<DateTimePickerModal theme="dark" cancelButtonColor="red" />
Some packages are actively maintained while others are legacy. Using deprecated code increases technical debt.
react-calendar is actively maintained with regular updates.
// react-calendar: Safe for new projects
import Calendar from 'react-calendar'; // Current API
react-datepicker is actively maintained and widely adopted.
// react-datepicker: Safe for new projects
import DatePicker from 'react-datepicker'; // Current API
react-datetime has slower update cycles and fewer contributors.
// react-datetime: Use with caution
import Datetime from 'react-datetime'; // Legacy API
react-native-date-picker is actively maintained for modern RN.
// react-native-date-picker: Safe for new projects
import DatePicker from 'react-native-date-picker'; // Current API
react-native-datepicker is deprecated and should be avoided.
// react-native-datepicker: DO NOT USE
import DatePicker from 'react-native-datepicker'; // Deprecated
react-native-modal-datetime-picker is actively maintained by the community.
// react-native-modal-datetime-picker: Safe for new projects
import DateTimePickerModal from 'react-native-modal-datetime-picker'; // Current API
You cannot mix web and native packages. Web packages rely on DOM events, while native packages rely on bridge modules.
react-calendar works only in React DOM (Web).
// react-calendar: Web only
ReactDOM.createRoot(document.getElementById('root')).render(<App />);
react-datepicker works only in React DOM (Web).
// react-datepicker: Web only
ReactDOM.createRoot(document.getElementById('root')).render(<App />);
react-datetime works only in React DOM (Web).
// react-datetime: Web only
ReactDOM.createRoot(document.getElementById('root')).render(<App />);
react-native-date-picker works only in React Native (Mobile).
// react-native-date-picker: Mobile only
AppRegistry.registerComponent('App', () => App);
react-native-datepicker works only in React Native (Mobile).
// react-native-datepicker: Mobile only
AppRegistry.registerComponent('App', () => App);
react-native-modal-datetime-picker works only in React Native (Mobile).
// react-native-modal-datetime-picker: Mobile only
AppRegistry.registerComponent('App', () => App);
| Feature | Web Packages | Native Packages |
|---|---|---|
| Rendering | š HTML/CSS DOM | š± iOS/Android Native Views |
| Styling | šØ Full CSS Control | šØ Limited System Themes |
| Input | āØļø Keyboard + Mouse | š Touch + System Wheels |
| Maintenance | ā Active (mostly) | ā ļø Mixed (Check Deprecation) |
Web Projects: Stick with react-datepicker for forms and react-calendar for dashboards. Avoid react-datetime unless you have a specific legacy requirement.
Mobile Projects: Use react-native-modal-datetime-picker for modals or react-native-date-picker for inline needs. Never use react-native-datepicker in new code.
Final Thought: The biggest risk is platform confusion. Ensure your team knows which packages are for web and which are for native ā mixing them will cause build failures. Prioritize maintained libraries to avoid future refactoring.
Choose react-calendar if you need a standalone calendar view without an input field, ideal for dashboards or scheduling views. It offers deep customization for tile rendering and navigation but requires you to build the input trigger yourself. It is best for web apps where the calendar is always visible or toggled via custom UI.
Choose react-datepicker if you need a standard input field that opens a calendar dropdown, similar to native browser date inputs but styled. It is the most popular choice for web forms requiring date selection with minimal setup. It balances customization with convention, making it safe for most admin panels and user settings.
Choose react-datetime if you require robust time selection alongside dates in a web environment, as it handles time zones and formats well. However, be aware it is older and less actively maintained than react-datepicker. It fits legacy projects or specific needs where its time-picker logic is required.
Choose react-native-date-picker if you want a direct, lightweight wrapper around native iOS and Android pickers without extra modal logic. It provides the most native feel and performance for mobile apps. It is ideal when you want the system default picker to appear inline or in a simple context.
Do NOT choose react-native-datepicker for new projects as it is largely deprecated and unmaintained. It was an early solution that has been superseded by community-driven native modules. Using it risks compatibility issues with newer React Native versions and lack of security updates.
Choose react-native-modal-datetime-picker if you need the native picker displayed inside a customizable modal dialog. It wraps the community standard picker, adding ease of use for toggling visibility and styling the container. It is best for mobile apps requiring a consistent modal pattern across iOS and Android.
Ultimate calendar for your React app.
npm install react-calendar or yarn add react-calendar.import Calendar from 'react-calendar'.<Calendar />. Use onChange prop for getting new values.A minimal demo page can be found in sample directory.
Online demo is also available!
react-calendar is under constant development. This documentation is written for react-calendar 4.x branch. If you want to see documentation for other versions of react-calendar, use dropdown on top of GitHub page to switch to an appropriate tag. Here are quick links to the newest docs from each branch:
Your project needs to use React 16.8 or later.
react-calendar uses modern web technologies. That's why it's so fast, lightweight and easy to style. This, however, comes at a cost of supporting only modern browsers.
If your locale isn't supported, you can use Intl.js or another Intl polyfill along with react-calendar.
Add react-calendar to your project by executing npm install react-calendar or yarn add react-calendar.
Here's an example of basic usage:
import { useState } from 'react';
import Calendar from 'react-calendar';
type ValuePiece = Date | null;
type Value = ValuePiece | [ValuePiece, ValuePiece];
function MyApp() {
const [value, onChange] = useState<Value>(new Date());
return (
<div>
<Calendar onChange={onChange} value={value} />
</div>
);
}
Check the sample directory in this repository for a full working example. For more examples and more advanced use cases, check Recipes in react-calendar Wiki.
If you want to use default react-calendar styling to build upon it, you can import react-calendar's styles by using:
import 'react-calendar/dist/Calendar.css';
Displays a complete, interactive calendar.
| Prop name | Description | Default value | Example values |
|---|---|---|---|
| activeStartDate | The beginning of a period that shall be displayed. If you wish to use react-calendar in an uncontrolled way, use defaultActiveStartDate instead. | (today) | new Date(2017, 0, 1) |
| allowPartialRange | Whether to call onChange with only partial result given selectRange prop. | false | true |
| calendarType | Type of calendar that should be used. Can be 'gregory, 'hebrew', 'islamic', 'iso8601'. Setting to "gregory" or "hebrew" will change the first day of the week to Sunday. Setting to "islamic" will change the first day of the week to Saturday. Setting to "islamic" or "hebrew" will make weekends appear on Friday to Saturday. | Type of calendar most commonly used in a given locale | 'iso8601' |
| className | Class name(s) that will be added along with "react-calendar" to the main react-calendar <div> element. | n/a |
|
| data-testid | The test ID used for testing purposes. | n/a | 'calendar' |
| defaultActiveStartDate | The beginning of a period that shall be displayed by default. If you wish to use react-calendar in a controlled way, use activeStartDate instead. | (today) | new Date(2017, 0, 1) |
| defaultValue | Calendar value that shall be selected initially. Can be either one value or an array of two values. If you wish to use react-calendar in a controlled way, use value instead. | n/a |
|
| defaultView | Determines which calendar view shall be opened initially. Does not disable navigation. Can be "month", "year", "decade" or "century". If you wish to use react-calendar in a controlled way, use view instead. | The most detailed view allowed | "year" |
| formatDay | Function called to override default formatting of day tile labels. Can be used to use your own formatting function. | (default formatter) | (locale, date) => formatDate(date, 'd') |
| formatLongDate | Function called to override default formatting of day tile abbr labels. Can be used to use your own formatting function. | (default formatter) | (locale, date) => formatDate(date, 'dd MMM YYYY') |
| formatMonth | Function called to override default formatting of month names. Can be used to use your own formatting function. | (default formatter) | (locale, date) => formatDate(date, 'MMM') |
| formatMonthYear | Function called to override default formatting of months and years. Can be used to use your own formatting function. | (default formatter) | (locale, date) => formatDate(date, 'MMMM YYYY') |
| formatShortWeekday | Function called to override default formatting of weekday names (shortened). Can be used to use your own formatting function. | (default formatter) | (locale, date) => formatDate(date, 'dd') |
| formatWeekday | Function called to override default formatting of weekday names. Can be used to use your own formatting function. | (default formatter) | (locale, date) => formatDate(date, 'dd') |
| formatYear | Function called to override default formatting of year in the top navigation section. Can be used to use your own formatting function. | (default formatter) | (locale, date) => formatDate(date, 'YYYY') |
| goToRangeStartOnSelect | Whether to go to the beginning of the range when selecting the end of the range. | true | false |
| inputRef | A prop that behaves like ref, but it's passed to main <div> rendered by <Calendar> component. | n/a |
|
| locale | Locale that should be used by the calendar. Can be any IETF language tag. Note: When using SSR, setting this prop may help resolving hydration errors caused by locale mismatch between server and client. | Server locale/User's browser settings | "hu-HU" |
| maxDate | Maximum date that the user can select. Periods partially overlapped by maxDate will also be selectable, although react-calendar will ensure that no later date is selected. | n/a | Date: new Date() |
| maxDetail | The most detailed view that the user shall see. View defined here also becomes the one on which clicking an item will select a date and pass it to onChange. Can be "month", "year", "decade" or "century". | "month" | "year" |
| minDate | Minimum date that the user can select. Periods partially overlapped by minDate will also be selectable, although react-calendar will ensure that no earlier date is selected. | n/a | Date: new Date() |
| minDetail | The least detailed view that the user shall see. Can be "month", "year", "decade" or "century". | "century" | "decade" |
| navigationAriaLabel | aria-label attribute of a label rendered on calendar navigation bar. | n/a | "Go up" |
| navigationAriaLive | aria-live attribute of a label rendered on calendar navigation bar. | undefined | "polite" |
| navigationLabel | Content of a label rendered on calendar navigation bar. | (default label) | ({ date, label, locale, view }) => alert(`Current view: ${view}, date: ${date.toLocaleDateString(locale)}`) |
| next2AriaLabel | aria-label attribute of the "next on higher level" button on the navigation pane. | n/a | "Jump forwards" |
| next2Label | Content of the "next on higher level" button on the navigation pane. Setting the value explicitly to null will hide the icon. | "Ā»" |
|
| nextAriaLabel | aria-label attribute of the "next" button on the navigation pane. | n/a | "Next" |
| nextLabel | Content of the "next" button on the navigation pane. Setting the value explicitly to null will hide the icon. | "āŗ" |
|
| onActiveStartDateChange | Function called when the user navigates from one view to another using previous/next button. Note that this function will not be called when e.g. drilling up from January 2021 to 2021 or drilling down the other way around.action signifies the reason for active start date change and can be one of the following values: "prev", "prev2", "next", "next2", "drillUp", "drillDown", "onChange". | n/a | ({ action, activeStartDate, value, view }) => alert('Changed view to: ', activeStartDate, view) |
| onChange | Function called when the user clicks an item (day on month view, month on year view and so on) on the most detailed view available. | n/a | (value, event) => alert('New date is: ', value) |
| onClickDay | Function called when the user clicks a day. | n/a | (value, event) => alert('Clicked day: ', value) |
| onClickDecade | Function called when the user clicks a decade. | n/a | (value, event) => alert('Clicked decade: ', value) |
| onClickMonth | Function called when the user clicks a month. | n/a | (value, event) => alert('Clicked month: ', value) |
| onClickWeekNumber | Function called when the user clicks a week number. | n/a | (weekNumber, date, event) => alert('Clicked week: ', weekNumber, 'that starts on: ', date) |
| onClickYear | Function called when the user clicks a year. | n/a | (value, event) => alert('Clicked year: ', value) |
| onDrillDown | Function called when the user drills down by clicking a tile. | n/a | ({ activeStartDate, view }) => alert('Drilled down to: ', activeStartDate, view) |
| onDrillUp | Function called when the user drills up by clicking drill up button. | n/a | ({ activeStartDate, view }) => alert('Drilled up to: ', activeStartDate, view) |
| onViewChange | Function called when the user navigates from one view to another using drill up button or by clicking a tile.action signifies the reason for view change and can be one of the following values: "prev", "prev2", "next", "next2", "drillUp", "drillDown", "onChange". | n/a | ({ action, activeStartDate, value, view }) => alert('New view is: ', view) |
| prev2AriaLabel | aria-label attribute of the "previous on higher level" button on the navigation pane. | n/a | "Jump backwards" |
| prev2Label | Content of the "previous on higher level" button on the navigation pane. Setting the value explicitly to null will hide the icon. | "Ā«" |
|
| prevAriaLabel | aria-label attribute of the "previous" button on the navigation pane. | n/a | "Previous" |
| prevLabel | Content of the "previous" button on the navigation pane. Setting the value explicitly to null will hide the icon. | "ā¹" |
|
| returnValue | Which dates shall be passed by the calendar to the onChange function and onClick{Period} functions. Can be "start", "end" or "range". The latter will cause an array with start and end values to be passed. | "start" | "range" |
| selectRange | Whether the user shall select two dates forming a range instead of just one. Note: This feature will make react-calendar return array with two dates regardless of returnValue setting. | false | true |
| showDoubleView | Whether to show two months/years/⦠at a time instead of one. Defaults showFixedNumberOfWeeks prop to be true. | false | true |
| showFixedNumberOfWeeks | Whether to always show fixed number of weeks (6). Forces showNeighboringMonth prop to be true. | false | true |
| showNavigation | Whether a navigation bar with arrows and title shall be rendered. | true | false |
| showNeighboringCentury | Whether decades from next century shall be rendered to fill the entire last row in. | false | true |
| showNeighboringDecade | Whether years from next decade shall be rendered to fill the entire last row in. | false | true |
| showNeighboringMonth | Whether days from previous or next month shall be rendered if the month doesn't start on the first day of the week or doesn't end on the last day of the week, respectively. | true | false |
| showWeekNumbers | Whether week numbers shall be shown at the left of MonthView or not. | false | true |
| tileClassName | Class name(s) that will be applied to a given calendar item (day on month view, month on year view and so on). | n/a |
|
| tileContent | Allows to render custom content within a given calendar item (day on month view, month on year view and so on). | n/a |
|
| tileDisabled | Pass a function to determine if a certain day should be displayed as disabled. | n/a | ({ activeStartDate, date, view }) => date.getDay() === 0 |
| value | Calendar value. Can be either one value or an array of two values. If you wish to use react-calendar in an uncontrolled way, use defaultValue instead. | n/a |
|
| view | Determines which calendar view shall be opened. Does not disable navigation. Can be "month", "year", "decade" or "century". If you wish to use react-calendar in an uncontrolled way, use defaultView instead. | The most detailed view allowed | "year" |
Displays a given month, year, decade and a century, respectively.
| Prop name | Description | Default value | Example values |
|---|---|---|---|
| activeStartDate | The beginning of a period that shall be displayed. | n/a | new Date(2017, 0, 1) |
| hover | The date over which the user is hovering. Used only when selectRange is enabled, to render a āWIPā range when the user is selecting range. | n/a | new Date(2017, 0, 1) |
| maxDate | Maximum date that the user can select. Periods partially overlapped by maxDate will also be selectable, although react-calendar will ensure that no later date is selected. | n/a | Date: new Date() |
| minDate | Minimum date that the user can select. Periods partially overlapped by minDate will also be selectable, although react-calendar will ensure that no earlier date is selected. | n/a | Date: new Date() |
| onClick | Function called when the user clicks an item (day on month view, month on year view and so on). | n/a | (value) => alert('New date is: ', value) |
| tileClassName | Class name(s) that will be applied to a given calendar item (day on month view, month on year view and so on). | n/a |
|
| tileContent | Allows to render custom content within a given item (day on month view, month on year view and so on). Note: For tiles with custom content you might want to set fixed height of react-calendar__tile to ensure consistent layout. | n/a | ({ date, view }) => view === 'month' && date.getDay() === 0 ? <p>It's Sunday!</p> : null |
| value | Calendar value. Can be either one value or an array of two values. | n/a |
|
The MIT License.
|
| Wojciech Maj |
Thank you to all our sponsors! Become a sponsor and get your image on our README on GitHub.
Thank you to all our backers! Become a backer and get your image on our README on GitHub.
Thank you to all our contributors that helped on this project!