shabbat-times
Scannednpx machina-cli add skill Makiya1202/ai-agents-skills/shabbat-times --openclawFiles (1)
SKILL.md
4.2 KB
Jewish Calendar & Shabbat Times
Access Shabbat times and Jewish calendar data via the Hebcal API.
Quick Start
// Get Shabbat times for a location
const response = await fetch(
'https://www.hebcal.com/shabbat?cfg=json&geonameid=5128581&M=on'
);
const data = await response.json();
Shabbat Times API
By GeoNames ID (Recommended)
const url = new URL('https://www.hebcal.com/shabbat');
url.searchParams.set('cfg', 'json');
url.searchParams.set('geonameid', '5128581'); // New York
url.searchParams.set('M', 'on'); // Include Havdalah
const response = await fetch(url);
const data = await response.json();
// Response
{
"title": "Hebcal New York January 2025",
"items": [
{
"title": "Candle lighting: 4:28pm",
"date": "2025-01-10T16:28:00-05:00",
"category": "candles"
},
{
"title": "Parashat Shemot",
"date": "2025-01-11",
"category": "parashat"
},
{
"title": "Havdalah: 5:31pm",
"date": "2025-01-11T17:31:00-05:00",
"category": "havdalah"
}
]
}
By Coordinates
const url = new URL('https://www.hebcal.com/shabbat');
url.searchParams.set('cfg', 'json');
url.searchParams.set('latitude', '32.0853');
url.searchParams.set('longitude', '34.7818');
url.searchParams.set('tzid', 'Asia/Jerusalem');
Jewish Calendar API
const url = new URL('https://www.hebcal.com/hebcal');
url.searchParams.set('cfg', 'json');
url.searchParams.set('v', '1');
url.searchParams.set('year', '2025');
url.searchParams.set('month', 'x'); // All months
// Optional parameters
url.searchParams.set('maj', 'on'); // Major holidays
url.searchParams.set('min', 'on'); // Minor holidays
url.searchParams.set('mod', 'on'); // Modern holidays
url.searchParams.set('nx', 'on'); // Rosh Chodesh
url.searchParams.set('ss', 'on'); // Special Shabbatot
url.searchParams.set('s', 'on'); // Weekly parsha
const response = await fetch(url);
const holidays = await response.json();
Hebrew Date Conversion
// Gregorian to Hebrew
const url = new URL('https://www.hebcal.com/converter');
url.searchParams.set('cfg', 'json');
url.searchParams.set('gy', '2025');
url.searchParams.set('gm', '1');
url.searchParams.set('gd', '15');
const response = await fetch(url);
const data = await response.json();
// { "hy": 5785, "hm": "Tevet", "hd": 15, "hebrew": "ט״ו בטבת תשפ״ה" }
React Hook
import { useState, useEffect } from 'react';
interface ShabbatTimes {
candleLighting: Date | null;
havdalah: Date | null;
parsha: string | null;
}
function useShabbatTimes(geonameid: string) {
const [times, setTimes] = useState<ShabbatTimes | null>(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
async function fetchTimes() {
const url = new URL('https://www.hebcal.com/shabbat');
url.searchParams.set('cfg', 'json');
url.searchParams.set('geonameid', geonameid);
url.searchParams.set('M', 'on');
const response = await fetch(url);
const data = await response.json();
const result: ShabbatTimes = {
candleLighting: null,
havdalah: null,
parsha: null
};
for (const item of data.items) {
if (item.category === 'candles') {
result.candleLighting = new Date(item.date);
} else if (item.category === 'havdalah') {
result.havdalah = new Date(item.date);
} else if (item.category === 'parashat') {
result.parsha = item.title.replace('Parashat ', '');
}
}
setTimes(result);
setLoading(false);
}
fetchTimes();
}, [geonameid]);
return { times, loading };
}
Common GeoNames IDs
| City | GeoNames ID |
|---|---|
| Jerusalem | 281184 |
| Tel Aviv | 293397 |
| New York | 5128581 |
| Los Angeles | 5368361 |
| London | 2643743 |
| Paris | 2988507 |
Resources
- Hebcal API Docs: https://www.hebcal.com/home/developer-apis
Source
git clone https://github.com/Makiya1202/ai-agents-skills/blob/master/skills/shabbat-times/SKILL.mdView on GitHub Overview
Shabbat-times enables apps to fetch Shabbat candle lighting, Havdalah, and Parashat data, plus Jewish calendar holidays and Hebrew dates through the Hebcal API. It helps developers build Zmanim-aware features, Hebrew date displays, and holiday-aware scheduling.
How This Skill Works
Call Hebcal endpoints (shabbat, hebcal, converter) by geonameid or coordinates to retrieve JSON data. Parse items by category (candles, havdalah, parashat) and convert times to the user’s tzid for accurate display.
When to Use It
- Add Shabbat candle lighting and Havdalah times to a local planning app.
- Show Jewish holidays, Parashat, and Rosh Chodesh in a calendar view.
- Convert Gregorian dates to Hebrew dates for events using the converter endpoint.
- Provide Zmanim-ready times for prayer or notifications in apps.
- Build Hebrew calendar-aware widgets for web or mobile.
Quick Start
- Step 1: Choose an endpoint, e.g. https://www.hebcal.com/shabbat?cfg=json&geonameid=5128581&M=on.
- Step 2: Fetch and parse data.items, reading by category (candles, havdalah, parashat) and times.
- Step 3: Render candleLighting, havdalah times, and parsha; optionally call the converter for Hebrew dates.
Best Practices
- Prefer geonameid for city precision; fallback to latitude/longitude if geonameid is unavailable.
- Always request Havdalah data by including M=on in the shabbat endpoint call.
- Set tzid to match the user’s time zone and convert times accordingly.
- Cache Hebcal responses with a reasonable TTL to reduce API calls and respect rate limits.
- Validate and gracefully handle missing fields (candleLighting, havdalah, parashat) and normalize date strings.
Example Use Cases
- A travel app showing Shabbat candle lighting and Havdalah times for New York using geonameid 5128581.
- A personal planner displaying Hebrew date, Parashat, and upcoming holidays for Jerusalem.
- An events calendar that lists major holidays and Rosh Chodesh from Hebcal data.
- A Zmanim widget that presents candle lighting and Havdalah times for a user’s location.
- An education app converting Gregorian dates to Hebrew dates via the converter endpoint.
Frequently Asked Questions
Add this skill to your agents