Giter Club home page Giter Club logo

hebrew-canlendar's Introduction

Getting Started with the React Hebrew Calendar component

This component is a simple calendar which displays the gergorian calendar and the hebrew calendar. This component also shows the following:

  1. Parashot Hashvua.
  2. Jewish Events

In order to install this component simply execute the following command:

npm i hebrewcalendar

Here is how you implement the component in your react code

import './App.css';
import Cal from 'hebrewcalendar/Cal';
import { DayObj } from 'hebrewcalendar/HebrewCalendar/interfaces/dayObj';
import { Language } from 'hebrewcalendar/HebrewCalendar/enums/language'; 

function App() {
  const selectDateHandler = (selectedDate) => {
    console.log('selectDateHandler', selectedDate);
  }

  return (
    <div className="App">
      <div className="celendarContainer"><Cal onSelectDate={(selectedDate) => selectDateHandler(selectedDate)} language={Language.Hebrew}></Cal></div>
    </div>
  );
}

export default App;

This new component has the following attributes:

  1. onSelectDate - This is a mandatory attributes which is activated every time the user chooses a specific date. Its argument is a DayObj interface which looks like this:
export interface DayObj {
    internationalDate: number;
    HebrewDate: HDate;
    DayOfWeek: number;
    ButtonDate: Date;
    ParashaShavua?: string;
    EventObj?: Array<Event>;
}
  • internationalDate - Day of the gregorian month
  • HebrewDate - An HDate object which describes the hebrew date object which consist the hebrew month, hebrew year, and hebrew day. more details about the HDate object can be found at: https://github.com/hebcal/hebcal-es6#hdate
  • DayOfWeek - Day of the week where Sunday is 0 and Saturday is 6.
  • ButtonDate - Gergorian javascript date object.
  • ParashaShavua - weekly "Parashat Hashvua" in a string object.
  • EventObj - Special event object in the Jewish year. More details can be found at: https://github.com/hebcal/hebcal-es6#Event
  1. selectedDate - optional, This attribute specifies a selected date of the hebrew calendar component. if ommited then the curerent date is selected.
  2. language - optional, language of the compoenent:
export enum Language {
    Hebrew = 'he',
    English = 'en'
}

If ommited then the default language is english.

Final words

This component is based on the hebcal-es6 javascript library and has its GPL-2.0 license.

A working sample of this component can be seen here.

This component was made by Kobi Krasnoff.

hebrew-canlendar's People

Contributors

krasnoff avatar

Watchers

 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.