A modern, fast and small calendar for React with English and Persian (Jalali) support
npm install react-calendar-datetime-pickerA modern, fast and small calendar for React with comprehensive support for Gregorian and Jalali (Persian) calendar systems.
š Full Documentation Website - Complete guide with examples, API reference, and more
- ā
Dual Calendar Support - Native support for both Gregorian and Jalali (Persian) calendars with automatic locale handling
- ā
Flexible Selection Modes - Single date, date range, multi-date, and week selection modes
- ā
Time Selection - Full time picker integration with 12-hour and 24-hour formats
- ā
TypeScript Support - Comprehensive type definitions with improved IntelliSense and type safety
- ā
Internationalization (i18n) - Full locale support for English, Persian, German, Spanish, and French with RTL support
- ā
Dark Mode - Built-in dark theme with automatic detection
- ā
Accessibility - Full keyboard navigation, ARIA labels, and WCAG 2.1 Level AA compliance
- ā
Preset Date Ranges - Built-in preset buttons for common ranges with custom preset support
- ā
Advanced Constraints - Minimum/maximum dates, disabled dates, and custom validation functions
- ā
Multiple Months Display - Display multiple calendar months side by side
- ā
Week Customization - Customize week start day, weekend highlighting, and weekday names
- ā
CSS Variables Support - Easy theming with CSS custom properties
- ā
Custom Trigger Elements - Use any React element as a trigger for the date picker
- ā
Input-less Mode - Display standalone calendars without input fields
- ā
Smart Modal Positioning - Intelligent modal positioning with automatic viewport adjustment
- ā
Comprehensive Error Handling - Robust error handling with onError callback for validation errors
- ā
Extended Utility Functions - Comprehensive date manipulation utilities and calendar conversions
``bash`
npm install react-calendar-datetime-pickeror
yarn add react-calendar-datetime-pickeror
pnpm add react-calendar-datetime-picker
`tsx
import { DtPicker } from 'react-calendar-datetime-picker'
import 'react-calendar-datetime-picker/style.css'
function App() {
const [date, setDate] = useState()
return (
onChange={setDate}
calendarSystem='gregorian'
locale='en'
/>
)
}
`
Version 2.x brings significant improvements and new capabilities:
- Better type definitions and improved IntelliSense
- Stricter type checking for a more robust development experience
- Enhanced onChange callback provides three parameters: normalized Day object, JavaScript Date (always Gregorian), and formatted string
- Optimized rendering and memoization
- Reduced bundle size for faster loading
- Custom icons, labels, translations, and CSS classes
- Complete control over component styling
- Comprehensive callback system for date selection, navigation, and user interactions
- Full keyboard navigation support
- ARIA labels and focus management
- Screen reader support
- Intelligent modal positioning that automatically adjusts based on viewport space
- Handles RTL/LTR layouts and dynamic repositioning
- Robust error handling system with onError callback
- Handles invalid dates, constraint violations, and provides detailed error information
For a complete list of features and migration guide, visit the documentation website.
This library supports:
- React - Built with modern React patterns (Hooks, Functional Components)
- TypeScript - Full TypeScript support with comprehensive type definitions
- Calendar - Full-featured calendar component with month/year navigation
- Date Picker - Interactive date selection with input field integration
- DateTime Picker - Combined date and time selection with 12/24-hour formats
- Time Picker - Full time selection with hours and minutes
- Date Range - Select start and end dates for range-based selections
- Multi-Date Selection - Select multiple individual dates
- Week Selection - Select entire weeks with customizable start days
- Persian - Native Persian (Farsi) locale support with RTL layout
- Jalali - Complete Jalali (Persian) calendar system implementation
- Gregorian - Standard Gregorian calendar system support
- i18n - Full internationalization support for multiple languages
- RTL - Right-to-left layout support for Persian and other RTL languages
- Locale - Support for English, Persian, German, Spanish, and French locales
- Localization - Customizable translations and regional formatting
- Dark Mode - Built-in dark theme with automatic detection
- Accessibility - WCAG 2.1 Level AA compliant with keyboard navigation and ARIA labels
- Modal - Smart modal positioning with automatic viewport adjustment
- Customization - Extensive customization options for styling, icons, and labels
- Theming - CSS variables support for easy theme integration
- Preset Ranges - Built-in preset buttons for common date ranges
- Constraints - Minimum/maximum dates, disabled dates, and custom validation
- Validation - Comprehensive error handling and validation system
- Utilities - Extended date manipulation and calendar conversion utilities
- Standalone Calendar - Input-less mode for embedded calendar displays
`bashInstall dependencies
pnpm install
- Website - Full documentation website with examples
- Architecture - Project architecture and structure
- Development Guide - Development workflow and guidelines
- Deployment Guide - Deployment guide for npm and GitHub Pages
- Monorepo Setup - Monorepo structure and configuration
- Version Management - Version management and publishing
See docs-dev/README.md for complete documentation index.
MIT Ā© mehdi-nasiri-jahroodi