You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

zaman

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zaman

React component that helps you to makes simple Farsi/Jalali/Shamsi date picker. It also has range date picker you can select multiple days in multiple months.

2.1.1
latest
Source
npmnpm
Version published
Weekly downloads
546
0.18%
Maintainers
1
Weekly downloads
 
Created
Source

Zaman

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

Design

I appreciate Ali Samandar's design of this library. Give him your support.

check out the codesandbox link.

Install

with npm

$ npm i zaman

with yarn

$ yarn add zaman

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

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 "zaman";

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

Range date picker

import { DatePicker } from "zaman";

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

Calendar

import { Calendar, CalendarProvider } from "zaman";

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 "zaman";

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

License

MIT License

Keywords

datepicker

FAQs

Package last updated on 26 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts