# react-jalali-picker

> A React component library for selecting dates, featuring both a DatePicker and a RangePicker that support Jalali (Persian) and Gregorian calendars.

Latest version **1.2.3** (published 2025-04-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-jalali-picker
pnpm add react-jalali-picker
yarn add react-jalali-picker
bun add react-jalali-picker
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.3 |
| Published | 2025-04-06 |
| First published | 2024-09-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 26.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Behzad Bakhshayesh |
| Maintainers | behzadbakhshayesh |
| Keywords | dayjs, date, date picker, range picker, farsi, jalali, gregory, datepicker, rangepicker, Persian, date-picker, range-picker, react |

## Links

- npm: https://www.npmjs.com/package/react-jalali-picker
- npm.io page: https://npm.io/package/react-jalali-picker

## Dependencies (4)

- [clsx](https://npm.io/package/clsx.md) ^2.1.1
- [dayjs](https://npm.io/package/dayjs.md) ^1.11.13
- [@types/prop-types](https://npm.io/package/@types/prop-types.md) ^15.7.13
- [jalali-plugin-dayjs](https://npm.io/package/jalali-plugin-dayjs.md) ^1.1.4

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.2.3 (latest) — 2025-04-06
- 1.2.2 — 2025-04-06
- 1.1.2 — 2025-03-29
- 1.1.1 — 2025-03-28
- 0.1.4 — 2024-10-06
- 0.1.3 — 2024-10-02
- 0.1.2 — 2024-10-02
- 0.1.1 — 2024-10-02
- 0.1.0 — 2024-10-02
- 0.0.9 — 2024-10-01
- 0.0.8 — 2024-09-30
- 0.0.6 — 2024-09-30
- 0.0.5 — 2024-09-30
- 0.0.4 — 2024-09-30
- 0.0.3 — 2024-09-30
- … 1 more at https://npm.io/package/react-jalali-picker/versions

## README

# React Jalali (Date or Range) Picker

A React component library for selecting dates, featuring both a DatePicker and a RangePicker that support Jalali and Gregorian calendars.

## 🚀 Live Demo
[![Open in GitHub Pages](https://img.shields.io/badge/Live%20Demo-%F0%9F%9A%80-blue?style=for-the-badge)](https://behzadbakhshayesh.github.io/react-jalali-picker-doc/)

![react-jalali-picker preview](https://raw.githubusercontent.com/BehzadBakhshayesh/react-jalali-picker-doc/main/public/rjp.png)


## Installation

To install the `react-jalali-picker` package, use npm or yarn:

```bash
npm install react-jalali-picker
# or
yarn add react-jalali-picker
```

## DatePicker Usage

```jsx
import React, { useState } from "react";
import { DatePicker } from "react-jalali-picker";
import "react-jalali-picker/dist/styles.css";

const App = () => {
  const [selectedDate, setSelectedDate] = useState(null);

  return (
    <div>
      <DatePicker value={selectedDate} onChange={(date)=>setSelectedDate(date)} />
    </div>
  );
};

export default App;
```

## DatePicker Props

| Prop name    | Type                                                            | Required | Default Value | Description                                                     |
| ------------ | --------------------------------------------------------------- | -------- | ------------- | --------------------------------------------------------------- |
| value        | `Dayjs \| null`                                                 | Yes      | `null`        | The currently selected date range as a Dayjs object.            |
| onChange     | `(range: { start: Dayjs \| null; end: Dayjs \| null }) => void` | Yes      | `undefined`   | Callback function called when the date range is updated.        |
| locale       | `"fa"`  or `"en"`                                               | No       | `"fa"`        | Sets the locale for displaying dates; defaults to Persian (fa). |
| calendarType | `"jalali"` or  `"gregory"`                                      | No       | `"jalali"`    | Determines which calendar system to use for date selection.     |
| direction    | `"rtl"`  or `"ltr"`                                             | No       | `"rtl"`       | Specifies the text direction; defaults to right-to-left (rtl).  |


## RangePicker Usage

```jsx
import React, { useState } from "react";
import { RangePicker  } from "react-jalali-picker";
import "react-jalali-picker/dist/styles.css";

const App = () => {
    const [dateRange, setDateRange] = useState({
    start: null,
    end: null,
  });

  return (
    <div>
      <RangePicker value={dateRange} onChange={(range)=>setDateRange(range)} />
    </div>
  );
};

export default App;
```

## RangePicker Props

| Prop         | Type                                                             | Required | Default Value | Description                                                     |
| ------------ | ---------------------------------------------------------------- | -------- | ------------- | --------------------------------------------------------------- |
| value        | `{ start: Dayjs \| null; end: Dayjs \| null; }`                  | Yes      | `null`        | The currently selected date range.                              |
| onChange     | `(range: { start: Dayjs \| null; end: Dayjs \| null; }) => void` | Yes      | `undefined`   | Callback function that is called when the date range changes.   |
| locale       | `"fa"`  or `"en"`                                                | No       | `"fa"`        | Sets the locale for displaying dates; defaults to Persian (fa). |
| calendarType | `"jalali"` or  `"gregory"`                                       | No       | `"jalali"`    | Determines which calendar system to use for date selection.     |
| direction    | `"rtl"`  or `"ltr"`                                              | No       | `"rtl"`       | Specifies the text direction; defaults to right-to-left (rtl).  |


## Author

- [Behzad Bakhshayesh](https://github.com/behzadbakhshayesh)

---
_Source: https://npm.io/package/react-jalali-picker · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
