3.1.3 • Published 5 years ago

davood-react-persian-datepicker v3.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

Davood React Persian Date Picker :calendar:

Persian calendar and date picker components for React. forked from @evandhq. in this madule we tried to make the source madule more user friendly and elaborated See the demo.

Installation

Use npm to install the package:

npm i davood-react-persian-datepicker --save

Usage

This package offers two components, Calendar and DatePicker. The first of which is a simple calendar that you can use in whichever way you want. The second one is an actual input with an input-ish behaviour.

This package uses moment-jalaali under the hood and all the values are basically moment objects.

Below is a basic example.

moment-jalaali

استفاده نمایید

برای مثال :

import React from "react";
import { Calendar, DatePicker } from "react-persian-datepicker";
import moment from "moment-jalaali";
let styles = {
  calendarContainer: "calendarContainer",
  dayPickerContainer: "dayPickerContainer",
  monthsList: "monthsList",
  daysOfWeek: "daysOfWeek",
  dayWrapper: "dayWrapper",
  selected: "selected",
  heading: "heading",
  next: "next",
  prev: "prev",
  title: "title",
  currentMonth: "currentMonth"
};

const MyComponent = () => (
  <div>
    <div>
      {/* Calendar Component */}
      <Calendar styles={styles} value={moment("1398/01/30", "jYYYY/jMM/jDD")} />
    </div>

    <div>
      {/* Date Picker Component */}
      <DatePicker
        calendarStyles={styles}
        value={moment("1398/01/30", "jYYYY/jMM/jDD")}
      />
    </div>
  </div>
);

if you want to implement your own styles you can change style object props

کلاس مورد نظر خود را جاگزین کرده و استایل های خود را وارد نمایید style می توانید با تغییر هر کدام از پراپرتی های شی