hebrewcalendar
v1.0.6
Published
this is a reactJs video component which a hebrew calendar
Downloads
15
Readme
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:
- Parashot Hashvua.
- 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:
onSelectDate
- This is a mandatory attributes which is activated every time the user chooses a specific date. Its argument is aDayObj
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 monthHebrewDate
- AnHDate
object which describes the Hebrew date object which consists of the Hebrew month, Hebrew year, and Hebrew day. more details about theHDate
object can be found at: https://github.com/hebcal/hebcal-es6#hdateDayOfWeek
- Day of the week where Sunday is 0 and Saturday is 6.ButtonDate
- Gregorian 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
selectedDate
- optional, This attribute specifies a selected date of the Hebrew calendar component. if omitted then the current date is selected.language
- optional, language of the component.
export enum Language {
Hebrew = 'he',
English = 'en'
}
format
- optional, general format of the component, large or small
The following attributes all all CSS customizing attributes and are React CSSProperties objects.
customCalWrapper
- optional, CSS of the whole componentcustomControllers
- optional, CSS of the top componentcustomInputText
- optional, CSS of the input text which represents the yearcustomSelect
- optional, CSS of the select month componentcustomSelectOption
- optional, CSS of the select month options componentcustomHebTitle
- optional, CSS of the custom Hebrew titlecustomTable
- optional, CSS of the custom tablecustomTr
- optional, CSS of the custom header rowcustomDataTr
- optional, CSS of the custom data rowcustomTd
- optional, CSS of the custom data cellcustomTh
- optional, CSS of the custom header cellcustomSpecialEvent
- optional, CSS of the custom special event cellcustomSaturday
- optional, CSS of the custom Saturday cellcustomSelectedDate
- optional, CSS of the custom selected date cellcustomButtonDateWrapper
- optional, CSS of the custom td inner contentcustomDate
- optional, CSS of the custom day in month componentcustomHebDate
- optional, CSS of the custom Hebrew daycustomGregDate
- optional, CSS of the custom Gregorian daycustomDesc
- optional, CSS of the custom description
If omitted 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.