0.1.4 • Published 10 months ago

react-jalali-picker v0.1.4

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

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.

Installation

To install the react-jalali-picker package, use npm or yarn:

npm install react-jalali-picker
# or
yarn add react-jalali-picker

DatePicker Usage

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 nameTypeRequiredDefault ValueDescription
valueDayjs \| nullYesnullThe currently selected date range as a Dayjs object.
onChange(range: { start: Dayjs \| null; end: Dayjs \| null }) => voidYesundefinedCallback 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

import React, { useState } from "react";
import { DatePicker } 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

PropTypeRequiredDefault ValueDescription
value{ start: Dayjs \| null; end: Dayjs \| null; }YesnullThe currently selected date range.
onChange(range: { start: Dayjs \| null; end: Dayjs \| null; }) => voidYesundefinedCallback 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

0.1.4

10 months ago

0.1.3

10 months ago

0.1.2

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago

0.0.9

10 months ago

0.0.8

10 months ago

0.0.6

10 months ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago