react-calendar, react-datepicker, react-dates, and react-datetime are all React components designed to handle date and time selection in web applications. However, they serve different architectural needs and maturity levels. react-calendar is a lightweight, dependency-free calendar view often used as a building block. react-datepicker is the most popular all-in-one solution offering a text input with a dropdown calendar. react-dates (by Airbnb) is a highly polished, range-selection focused library that is now deprecated and should be avoided for new projects. react-datetime is an older picker that supports time selection but has seen significantly reduced maintenance activity compared to modern alternatives.
Selecting a date picker library is a common but critical architectural decision in React development. The choice impacts bundle size, accessibility compliance, dependency management, and long-term maintainability. While react-calendar, react-datepicker, react-dates, and react-datetime all solve the problem of date selection, they approach it with vastly different philosophies and current statuses. Let's break down how they differ in real-world engineering scenarios.
The most important factor in this comparison is the lifecycle status of the libraries. Using a deprecated library introduces security risks and technical debt.
react-dates is officially deprecated. The maintainers at Airbnb have archived the repository and advised users to migrate away from it. It relies on older React patterns and requires moment.js, which is itself in maintenance mode.
// react-dates: DO NOT USE in new projects
// This library is archived and no longer receives security updates
import { DateRangePicker } from 'react-dates';
<DateRangePicker
startDate={startDate}
endDate={endDate}
onDatesChange={({ startDate, endDate }) => {/*...*/}}
/>;
react-datetime has significantly slowed development. While not formally archived, it remains tightly coupled with moment.js. Modern React ecosystems are moving toward date-fns or native Intl APIs, making this a risky choice for new greenfield projects.
// react-datetime: High risk for new projects due to Moment.js dependency
import Datetime from 'react-datetime';
import moment from 'moment';
<Datetime value={selectedDate} onChange={setSelectedDate} />
react-datepicker and react-calendar are both actively maintained. They have moved away from heavy reliance on moment.js (or made it optional) and support modern React features like hooks and strict mode.
// react-datepicker: Active maintenance, modern API
import DatePicker from 'react-datepicker';
import { registerLocale } from 'react-datepicker';
<DatePicker selected={startDate} onChange={setStartDate} />
// react-calendar: Active maintenance, zero dependencies
import Calendar from 'react-calendar';
<Calendar onChange={setDate} value={date} />
Understanding whether a library provides a full input widget or just a calendar view is essential for architecture.
react-datepicker and react-datetime are "Input Wrappers." They render a text input field and manage a popover containing the calendar. They handle focus management, click-outside detection, and formatting automatically.
// react-datepicker: Renders input + popover automatically
<DatePicker
showTimeSelect
dateFormat="Pp"
selected={date}
onChange={(date) => setDate(date)}
/>
// react-datetime: Renders input + popover automatically
<Datetime
timeFormat="HH:mm"
value={date}
onChange={setDate}
/>
react-calendar is a "View Only" component. It renders the grid of days but does not include an input field or popover logic. You must build the surrounding UI yourself. This offers maximum flexibility but requires more boilerplate.
// react-calendar: You must build the input and popover logic
const [isOpen, setIsOpen] = useState(false);
const [date, setDate] = useState(new Date());
return (
<div>
<input
value={date.toDateString()}
onClick={() => setIsOpen(!isOpen)}
readOnly
/>
{isOpen && (
<Calendar
onClickOutside={() => setIsOpen(false)}
onChange={setDate}
value={date}
/>
)}
</div>
);
react-dates was also an Input Wrapper but specifically optimized for range selection (Start Date to End Date). Its deprecation leaves a gap for complex range inputs, often forcing developers to combine react-calendar with custom logic.
// react-dates: Specialized range input (Deprecated)
<DateRangePicker
startDateId="start_date"
endDateId="end_date"
// ...props
/>
Handling date ranges (e.g., hotel bookings) is a common requirement where these libraries diverge sharply.
react-dates was the industry standard for ranges, offering sophisticated logic for hover states and blocked dates. Since it is deprecated, you cannot use it safely.
// react-dates: Excellent range logic but unsafe to use
<DateRangePicker
numberOfMonths={2}
isOutsideRange={() => false}
// ...
/>
react-datepicker supports ranges natively in recent versions. It allows selecting a start and end date in one continuous interaction.
// react-datepicker: Built-in range support
<DatePicker
selectsRange
startDate={startDate}
endDate={endDate}
onChange={(update) => {
const [start, end] = update;
setStartDate(start);
setEndDate(end);
}}
isClearable={true}
/>
react-calendar supports ranges via the selectRange prop, but again, you must handle the display logic.
// react-calendar: Range selection logic included, UI is manual
<Calendar
selectRange={true}
onChange={setDateRange} // Returns [start, end]
value={dateRange}
/>
react-datetime does not have built-in range selection. You would need to manage two separate instances and validate the logic manually, which increases the risk of bugs.
// react-datetime: No native range support
// Requires two separate components and manual validation
<Datetime value={startDate} onChange={setStartDate} />
<Datetime value={endDate} onChange={setEndDate} />
Dependency management is a key architectural concern. Heavy dependencies like moment.js can bloat your bundle and slow down build times.
react-datetime and react-dates strictly require moment.js and prop-types. This locks you into a larger bundle size and an older date manipulation paradigm.
// react-datetime / react-dates: Heavy dependency chain
// Requires: moment, prop-types
import moment from 'moment';
react-datepicker originally depended on moment.js but has shifted to make it optional or uses date-fns in newer configurations, allowing for tree-shaking and smaller bundles.
// react-datepicker: Flexible dependencies
// Can work with native Date objects or date-fns
import { format } from 'date-fns';
react-calendar has zero dependencies. It is incredibly lightweight and does not force any date manipulation library on you. You can use native JS Date objects or any library you prefer.
// react-calendar: Zero dependencies
// Pure React, works with native Date objects
const nextMonth = new Date(date);
nextMonth.setMonth(nextMonth.getMonth() + 1);
How easily can you match the component to your design system?
react-calendar provides a clean, semantic class structure but relies on CSS for all styling. It does not use inline styles, making it easy to override with CSS modules or Tailwind.
/* react-calendar: Easy CSS override */
.react-calendar__tile--active {
background: #006ed3;
color: white;
}
react-datepicker uses SCSS and provides a default theme. Customization often requires overriding specific class names or passing custom class names to props.
// react-datepicker: Custom class names
<DatePicker
className="custom-input"
calendarClassName="custom-calendar"
dayClassName={(date) =>
date.getDay() === 0 ? 'sunday-highlight' : undefined
}
/>
react-dates used a unique CSS-in-JS approach (via aphrodite) which made overriding styles difficult without ejecting or deeply nesting selectors. This was a common pain point for developers.
// react-dates: Difficult styling due to CSS-in-JS internals
// Required complex theme overrides
You need a simple date field for a user's birthdate in a registration form.
react-datepicker<DatePicker
selected={birthdate}
onChange={(date) => setBirthdate(date)}
dateFormat="MM/dd/yyyy"
/>
You are building an admin dashboard where users click days to view analytics, not to set a form value.
react-calendarreact-calendar is lightweight and dependency-free.<Calendar
onClickDay={(value) => loadAnalytics(value)}
tileClassName={({ date }) =>
hasEvent(date) ? 'event-day' : null
}
/>
Users need to select a check-in and check-out date with visual feedback for the range.
react-datepicker (with selectsRange)react-dates is deprecated. react-datepicker now handles ranges well without the baggage of Moment.js.<DatePicker
selectsRange
startDate={checkIn}
endDate={checkOut}
onChange={(dates) => {
const [start, end] = dates;
setCheckIn(start);
setCheckOut(end);
}}
/>
You are maintaining an old internal tool that already uses moment.js extensively and needs time selection.
react-datetime (only if migration is impossible)moment logic, though migration to react-datepicker + date-fns should be planned.<Datetime
value={meetingTime}
onChange={(val) => setMeetingTime(val)}
timeFormat="HH:mm"
/>
| Feature | react-calendar | react-datepicker | react-dates | react-datetime |
|---|---|---|---|---|
| Status | β Active | β Active | β Deprecated | β οΈ Low Activity |
| Type | View Only | Input + Popover | Input + Popover | Input + Popover |
| Range Support | Yes (Manual UI) | Yes (Native) | Yes (Native) | No (Manual) |
| Dependencies | None | Optional (date-fns) | Moment.js | Moment.js |
| Time Selection | No | Yes | No | Yes |
| Styling | CSS Classes | SCSS / Classes | CSS-in-JS | CSS Classes |
For new projects, react-datepicker is the most balanced choice. It offers a complete input experience, supports ranges, and has an active community maintaining it against modern React standards.
If you need a custom UI or just a calendar grid without the input chrome, react-calendar is superior due to its zero-dependency architecture and flexibility.
Avoid react-dates entirely; its deprecation makes it a liability. Similarly, avoid react-datetime unless you are stuck in a legacy moment.js environment. The industry has moved toward native Date objects and lighter libraries like date-fns, and your date picker choice should reflect that shift.
Choose react-calendar if you need a standalone calendar view without an associated text input, or if you want to build a custom date picker wrapper from scratch. It is ideal for dashboards, booking interfaces, or scenarios where you need full control over the input mechanism while relying on a robust, dependency-free calendar engine.
Choose react-datepicker for standard form inputs where users need to pick a single date, a date range, or include time selection via a dropdown. It is the safest bet for most general-purpose applications due to its active maintenance, extensive configuration options, and lack of heavy external dependencies like Moment.js.
Do NOT choose react-dates for any new project. It has been officially deprecated by its maintainers (Airbnb) in favor of react-dates's successor or other modern solutions. It relies on older patterns and lacks the long-term support required for production environments. Evaluate react-datepicker or react-range-calendar instead.
Choose react-datetime only if you are maintaining a legacy application that already depends on it and specifically requires its Moment.js-based time picking interface. For new developments, avoid this package due to its reliance on the deprecated Moment.js ecosystem and slower update cadence compared to react-datepicker.
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!