1.0.0 • Published 3 months ago

persian-fullcalendar1 v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 months ago

persian-fullcalendar

persian-fullcalendar is a lightweight React component for creating a Jalali/Georgian datepicker. There is also a range datepicker and timepicker in persian-fullcalendar. The module can also be customized to match the appearance of your designs.

Install

with npm

$ npm i persian-fullcalendar

with yarn

$ yarn add persian-fullcalendar

Props

Date Picker and Calendar

propstypedefault
defaultValuetimestamp | Date | Dayjsundefined
weekendnumber[]undefined
roundstring one of thin | x1 | x2 | x3 | x4thin
accentColorstring#0D59F2
localestring one of fa | enfa
directionstring one of rtl | ltrrtl
onChangefunctionundefined
rangebooleanfalse
fromtimestamp | Date | Dayjsundefined
totimestamp | Date | Dayjsundefined
showbooleanfalse
inputClassstringnull
inputAttributesobject of InputHTMLAttributesnull
classNamestringnull
customShowDateFormatstring ex: YYYY MMMM DD or DD/MM etc.undefined
positionright | left | centerright
widthnumber
heightnumber
itemWidthnumber
itemHeightnumber
eventsarray of json
weekDaysstring shortWeekDays longWeekDays

Calendar Provider

propstypedefault
roundstring one of thin | x1 | x2 | x3 | x4thin
accentColorstring#0D59F2
localestring one of fa | enfa
directionstring one of rtl | ltrrtl
childrenReactNodenull

Time Picker

propstypedefault
defaultValuetimestamp | Date | DayjsDate
roundstring one of thin | x1 | x2 | x3 | x4thin
accentColorstring#0D59F2
localestring one of fa | enfa
clockTimenumber one of 12 | 2424
inputClassstringnull
inputAttributesobject of InputHTMLAttributesnull

Usages

Date picker

import { DatePicker } from "persian-fullcalendar";

function App() {
  return (
    <DatePicker onChange={(e) => console.log(e.value)} />
  )
}

Range date picker

import { DatePicker } from "persian-fullcalendar";

function App() {
  return (
    <DatePicker onChange={(e) => console.log(e.from, e.to)} range />
  )
}

Calendar

import { Calendar, CalendarProvider } from "persian-fullcalendar";

function App() {
  const [calendarValue, setCalendarValue] = useState(new Date())

  return (
    <CalendarProvider>
      <Calendar
        defaultValue={calendarValue}
        onChange={(e) => setCalendarValue(new Date(e.value))}
      />
    </CalendarProvider>
  )
}

Time picker

import { TimePicker } from "persian-fullcalendar";

function App() {
  return (
    <TimePicker
      onChange={(e) => console.log(e.hour, e.minute, e.timeConvention)}
    />
  )
}