Giter Site home page Giter Site logo

truongnat / zaman Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rzkhosroshahi/zaman

0.0 0.0 0.0 1.35 MB

It's a lightweight React component for creating a Jalali/Georgian datepicker

Home Page: https://rzkhosroshahi.github.io/zaman-landing

License: MIT License

Shell 0.19% JavaScript 1.95% TypeScript 95.59% CSS 1.44% HTML 0.82%

zaman's Introduction

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

props type default
defaultValue timestamp | Date | Dayjs undefined
weekend number[] undefined
round string one of thin | x1 | x2 | x3 | x4 thin
accentColor string #0D59F2
locale string one of fa | en fa
direction string one of rtl | ltr rtl
onChange function undefined
range boolean false
from timestamp | Date | Dayjs undefined
to timestamp | Date | Dayjs undefined
show boolean false
inputClass string null
inputAttributes object of InputHTMLAttributes null
className string null

Calendar Provider

props type default
round string one of thin | x1 | x2 | x3 | x4 thin
accentColor string #0D59F2
locale string one of fa | en fa
direction string one of rtl | ltr rtl
children ReactNode null

Time Picker

props type default
defaultValue timestamp | Date | Dayjs Date
round string one of thin | x1 | x2 | x3 | x4 thin
accentColor string #0D59F2
locale string one of fa | en fa
clockTime number one of 12 | 24 24

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={(day) => setCalendarValue(new Date(day))}
      />
    </CalendarProvider>
  )
}

Time picker

import { TimePicker } from "zaman";

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

License

MIT License

zaman's People

Contributors

rzkhosroshahi avatar dependabot[bot] avatar mehrad77 avatar zmashhadizadeh avatar mehdiraized avatar immorez avatar themasix avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.