Jewish holidays and Hebrew calendar as plain JSON objects, RSS, and CSV export
$ npm install @hebcal/rest-api
import {HebrewCalendar, Location} from '@hebcal/core';
import {eventsToClassicApi, eventsToCsv} from '@hebcal/rest-api';
const options = {
year: 2020,
month: 2,
sedrot: true,
candlelighting: true,
location: Location.lookup('Hawaii'),
};
const events = HebrewCalendar.calendar(options);
const apiResult = eventsToClassicApi(events, options);
console.log(JSON.stringify(apiResult));
const csv = eventsToCsv(events, options);
console.log(JSON.stringify(csv));
-
locationToPlainObj(location) ⇒
LocationPlainObj
-
Converts a @hebcal/core
Location
to a plain JS object. -
makeAnchor(s) ⇒
string
-
Helper function to transform a string to make it more usable in a URL or filename. Converts to lowercase and replaces non-word characters with hyphen ('-').
-
getDownloadFilename(options) ⇒
string
-
pad2(number) ⇒
string
-
pad4(number) ⇒
string
-
toISOString(d) ⇒
string
-
Returns just the date portion as YYYY-MM-DD
-
getEventCategories(ev) ⇒
Array.<string>
-
Returns a category and subcategory name
-
renderTitleWithoutTime(ev) ⇒
string
-
Renders the event title in default locale, but strips off time
-
getCalendarTitle(events, options) ⇒
string
-
Generates a title like "Hebcal 2020 Israel" or "Hebcal May 1993 Providence"
-
getHolidayDescription(ev, [firstSentence]) ⇒
string
-
Returns an English language description of the holiday
-
makeTorahMemoText(ev, il) ⇒
string
-
Makes mulit-line text that summarizes Torah & Haftarah
-
appendIsraelAndTracking(url, il, utmSource, utmMedium, utmCampaign) ⇒
string
-
Appends utm_source and utm_medium parameters to a URL
-
eventToCsv(e, options) ⇒
string
-
Renders an Event as a string
-
eventsToCsv(events, options) ⇒
string
-
eventsToClassicApi(events, options, [leyning]) ⇒
Object
-
Formats a list events for the classic Hebcal.com JSON API response
-
eventToClassicApiObject(ev, options, [leyning]) ⇒
Object
-
Converts a Hebcal event to a classic Hebcal.com JSON API object
-
formatAliyot(result, aliyot) ⇒
Object
-
formatLeyningResult(reading) ⇒
Object
-
eventsToRss2(events, options) ⇒
string
-
eventToRssItem2(ev, options) ⇒
string
-
eventToFullCalendar(ev, tzid, il) ⇒
Object
-
Converts a Hebcal event to a FullCalendar.io object
-
LocationPlainObj :
Object
-
Location information
locationToPlainObj(location) ⇒ LocationPlainObj
Converts a @hebcal/core Location
to a plain JS object.
Kind: global function
Param | Type |
---|---|
location | Location |
Helper function to transform a string to make it more usable in a URL or filename. Converts to lowercase and replaces non-word characters with hyphen ('-').
Kind: global function
Param | Type |
---|---|
s | string |
Example
makeAnchor('Rosh Chodesh Adar II') // 'rosh-chodesh-adar-ii'
Kind: global function
Param | Type |
---|---|
options | CalOptions |
Kind: global function
Param | Type |
---|---|
number | number |
Kind: global function
Param | Type |
---|---|
number | number |
Returns just the date portion as YYYY-MM-DD
Kind: global function
Param | Type |
---|---|
d | Date |
Returns a category and subcategory name
Kind: global function
Param | Type |
---|---|
ev | Event |
Renders the event title in default locale, but strips off time
Kind: global function
Param | Type |
---|---|
ev | Event |
Generates a title like "Hebcal 2020 Israel" or "Hebcal May 1993 Providence"
Kind: global function
Param | Type |
---|---|
events | Array.<Event> |
options | CalOptions |
Returns an English language description of the holiday
Kind: global function
Param | Type | Default |
---|---|---|
ev | Event |
|
[firstSentence] | boolean |
false |
Makes mulit-line text that summarizes Torah & Haftarah
Kind: global function
Param | Type |
---|---|
ev | Event |
il | boolean |
Appends utm_source and utm_medium parameters to a URL
Kind: global function
Param | Type |
---|---|
url | string |
il | boolean |
utmSource | string |
utmMedium | string |
utmCampaign | string |
Renders an Event as a string
Kind: global function
Param | Type |
---|---|
e | Event |
options | CalOptions |
Kind: global function
Param | Type |
---|---|
events | Array.<Event> |
options | HebcalOptions |
Formats a list events for the classic Hebcal.com JSON API response
Kind: global function
Param | Type | Default |
---|---|---|
events | Array.<Event> |
|
options | CalOptions |
|
[leyning] | boolean |
true |
Converts a Hebcal event to a classic Hebcal.com JSON API object
Kind: global function
Param | Type | Default |
---|---|---|
ev | Event |
|
options | CalOptions |
|
[leyning] | boolean |
true |
Kind: global function
Param | Type |
---|---|
result | Object |
aliyot | Object |
Kind: global function
Param | Type |
---|---|
reading | Leyning |
Kind: global function
Param | Type |
---|---|
events | Array.<Event> |
options | CalOptions |
Kind: global function
Param | Type |
---|---|
ev | Event |
options | CalOptions |
Converts a Hebcal event to a FullCalendar.io object
Kind: global function
Param | Type | Description |
---|---|---|
ev | Event |
|
tzid | string |
timeZone identifier |
il | boolean |
true if Israel |
Location information
Kind: global typedef
Properties
Name | Type |
---|---|
title | string |
city | string |
tzid | string |
latitude | number |
longitude | number |
cc | string |
country | string |
admin1 | string |
asciiname | string |
geo | string |
zip | string |
state | string |
stateName | string |
geonameid | number |