All Projects → Shmulik-Kravitz → react-jewish-datepicker

Shmulik-Kravitz / react-jewish-datepicker

Licence: MIT license
React jewish datepicker

Programming Languages

typescript
32286 projects
CSS
56736 projects
HTML
75241 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-jewish-datepicker

KosherZmanim
Port of the KosherJava zmanim library to TypeScript
Stars: ✭ 29 (-29.27%)
Mutual labels:  hebrew-calendar, hebrew-date
hebcal-es6
Hebcal, a perpetual Jewish Calendar (ES6)
Stars: ✭ 45 (+9.76%)
Mutual labels:  hebrew-calendar, hebrew-date
React Datepicker
An easily internationalizable, accessible, mobile-friendly datepicker library for the web, build with styled-components.
Stars: ✭ 252 (+514.63%)
Mutual labels:  datepicker
yap
Yet Another (natural language) Parser
Stars: ✭ 40 (-2.44%)
Mutual labels:  hebrew
NEMO
Neural Modeling for Named Entities and Morphology (Hebrew NER)
Stars: ✭ 25 (-39.02%)
Mutual labels:  hebrew
nativescript-datetimepicker
Plugin with date and time picking fields
Stars: ✭ 26 (-36.59%)
Mutual labels:  datepicker
react-monthrange-picker
ReactJS month calendar component
Stars: ✭ 14 (-65.85%)
Mutual labels:  datepicker
Didatepicker
Yet another datepicker for iOS
Stars: ✭ 242 (+490.24%)
Mutual labels:  datepicker
mobile-select-date
手机联动选择日期
Stars: ✭ 41 (+0%)
Mutual labels:  datepicker
react-semantic-ui-datepickers
Datepickers built with Semantic UI for React and Dayzed.
Stars: ✭ 87 (+112.2%)
Mutual labels:  datepicker
Calendar.js
📅 A drag & drop event calendar (for Javascript), that is fully responsive and compatible with all modern browsers.
Stars: ✭ 29 (-29.27%)
Mutual labels:  datepicker
react-modern-datepicker
A modern date picker for react library
Stars: ✭ 19 (-53.66%)
Mutual labels:  datepicker
datepickertimeline
Linear date picker for Jetpack compose
Stars: ✭ 43 (+4.88%)
Mutual labels:  datepicker
praecox-datepicker
A date picker built with Svelte.Simple and flexible, supporting functions such as single selection, multiple selection, disabling, and marking.
Stars: ✭ 66 (+60.98%)
Mutual labels:  datepicker
Vue Datepicker Ui
Datepicker Component For Vue
Stars: ✭ 252 (+514.63%)
Mutual labels:  datepicker
ic-datepicker
Angular (2+) datepicker component
Stars: ✭ 27 (-34.15%)
Mutual labels:  datepicker
Adm Datetimepicker
Pure AngularJs dateTimePicker
Stars: ✭ 244 (+495.12%)
Mutual labels:  datepicker
monthyear-picker
Month and Year picker library for Android
Stars: ✭ 34 (-17.07%)
Mutual labels:  datepicker
react-calendar-datetime-picker
A simple and fast date and time picker component for React
Stars: ✭ 58 (+41.46%)
Mutual labels:  datepicker
vue2-persian-datepicker
A vue component that provides datepicker for persian developers
Stars: ✭ 100 (+143.9%)
Mutual labels:  datepicker

react-jewish-datepicker

npm CI license size minzip downloads stars

npm

ReactJewishDatePicker

General JewishDatePicker component.

See also demo and documentation page.

Installation

yarn add react-jewish-datepicker

Or with npm

npm install react-jewish-datepicker --save

Usage

TypeScript example:

import * as React from "react";
import {
  ReactJewishDatePicker,
  BasicJewishDay,
  BasicJewishDate
} from "react-jewish-datepicker";
import "react-jewish-datepicker/dist/index.css";
import {
  JewishMonth,
} from "jewish-dates-core";

export default function App() {
  const [basicJewishDay, setBasicJewishDay] = React.useState<BasicJewishDay>();
  const basicJewishDate: BasicJewishDate = {
    day: 13,
    monthName: JewishMonth.Elul,
    year: 5788
  };

  return (
    <>
      <div>
        Hebrew:
        <ReactJewishDatePicker
          value={basicJewishDate}
          isHebrew
          onClick={(day: BasicJewishDay) => {
            setBasicJewishDay(day);
          }}
        />
      </div>
    </>
  );
}

Edit react-jewish-datepicker-typescript-example

JavaScript example:

import * as React from "react";
import { ReactJewishDatePicker, BasicJewishDay } from "react-jewish-datepicker";
import "react-jewish-datepicker/dist/index.css";

export default function App() {
  const [basicJewishDay, setBasicJewishDay] = React.useState();
  return (
    <ReactJewishDatePicker
      value={new Date()}
      isHebrew
      onClick={(day) => {
        setBasicJewishDay(day);
      }}
    />
  );
}

Edit react-jewish-datepicker-javascript-example

props

Prop name Description Value types
canSelect Accepts a function which determines whether a day is selectable (day: BasicJewishDay) => condition ? false : true
isHebrew Optional. Whether the view language is hebrew or english, Default is false false | true
isRange Optional. Allow to select date ranges. Default is false false | true
onClick Callback when a date is selected (day: BasicJewishDay) => console.log(day) | (startDay: BasicJewishDay, endDay: BasicJewishDay) => console.log(startDay, endDay)
value Optional. Initial selected date Date | BasicJewishDate | BasicJewishDateRange | DateRange

canSelect prop

The canSelect can take either a costum function or one of the build-in functions as follows.

dontSelectHolidays([isIsrael: boolean]) ⇒ (day: BasicJewishDay) => boolean

Takes isIsrael param and returns a function which in turn is passed to the canSelect prop, in order to prevent holidays (corresponding with isIsrael param) selection.

Param Type Default
isIsrael boolean false

See example here

dontSelectShabat(day: BasicJewishDay) ⇒ boolean

A function to be passed to the canSelect prop, in order to prevent shabat selection.

See example here

dontSelectShabatAndHolidays([isIsrael: boolean]) ⇒ (day: BasicJewishDay) => boolean

Takes isIsrael param and returns a function to be passed to the "canSelect" prop. combines dontSelectHolidays and dontSelectShabat in order to prevent both - shabat and holidays selection.

Param Type Default
isIsrael boolean false

See example here

dontSelectOutOfRange(minDate: Date | null, maxDate: Date | null) ⇒ (day: BasicJewishDay) => boolean

Takes min date and max date and returns a function to be passed to the "canSelect" prop, in order to prevent selection out of the supplied range.

You can pass a date only for one of the params and null to the other. In this case, the selectable range will be up to max date or from min date.

Param Type
minDate Date | null
maxDate Date | null

See example here

Helper Functions

addDates(date: BasicJewishDate | Date, numDays: number) ⇒ Date

a helper function for dontSelectOutOfRange.

Takes a BasicJewishDate object or a Date, adds a date interval (numDays) to the date and then returns the new date.

Param Type
date BasicJewishDate | Date
numDays number

See example here

subtractDates(date: BasicJewishDate | Date, numDays: number) ⇒ Date

a helper function for dontSelectOutOfRange.

Takes a BasicJewishDate object or a Date, subtracts a date interval (numDays) from the date and then returns the new date.

Param Type
date BasicJewishDate | Date
numDays number

See example here

jewish-dates-core

To create a jewish date picker in vue.js or angular, see the core dependency.

Contributors

License: MIT.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].