A Python package for handling Hebrew dates
Project description
hebrewdate
A comprehensive Python library for working with the Hebrew calendar, providing date conversions, calendar generation, and holiday information.
Key Features
- Conversion: Seamlessly convert between Hebrew and Gregorian dates.
- Holidays: Built-in support for major holidays, festive days (Chol HaMoed, Hanukkah), and fasts.
- Arithmetic: Easily add or subtract days, months, or years from Hebrew dates.
- Calendar: Generate text or HTML calendars for any Hebrew month or year.
- Leap Years: Full handling of the 19-year Hebrew calendar cycle.
- Traditional Formatting: Support for traditional Hebrew year strings (e.g., ה'תשפ"ה).
Installation
pip install hebrewdate
Quick Start
Basic Date Operations
from hebrewdate import HebrewDate
# Get today's Hebrew date
today = HebrewDate.today()
print(today) # יום חמישי יט כסלו ה'תשפ"ה
# Create a specific Hebrew date
date = HebrewDate(15, "ניסן", 5785)
print(date.to_gregorian()) # 2025-04-13
# Date arithmetic
next_week = date + 7
print(next_week) # יום ראשון כב ניסן ה'תשפ"ה
# Check for holidays
if date.is_holiday:
print(f"Today is {date.holiday}") # Today is יו"ט ראשון של פסח
Working with Years and Months
from hebrewdate import HebrewYear, HebrewMonth
# Explore a Hebrew year
year = HebrewYear(5784)
print(year.is_leap) # True
print(year.month_count) # 13
# Explore a Hebrew month
month = HebrewMonth(year, "אדר א")
print(month.length) # 30
Generating HTML Calendars
from hebrewdate import HTMLHebrewCalendar
# Create an HTML calendar for Tishrei 5785
cal = HTMLHebrewCalendar(with_gregorian=True, with_holidays=True)
html = cal.formatmonth(5785, 1)
# Save to file
with open("calendar.html", "w", encoding="utf-8") as f:
f.write(html)
Limitations
- Supported Python versions: 3.9 and later.
- Date conversions before 1752 CE may be slightly inaccurate due to historical calendar variations.
- Extremely ancient dates might not be convertible to the Gregorian system.
License
This project is licensed under the MIT License.
Author
Isaac Dovolsky
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hebrewdate-2.2.1.tar.gz.
File metadata
- Download URL: hebrewdate-2.2.1.tar.gz
- Upload date:
- Size: 20.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca9a6ce31d84d738fd3a296ae57d3abc51ba8621a02e51721510ed05768393f6
|
|
| MD5 |
5259fa3e44dfe832f521ebf90cc6818f
|
|
| BLAKE2b-256 |
9c2f11757fecc60ccf68a7367739b1c766491205a7cc1f667281a52b9906e58c
|
Provenance
The following attestation bundles were made for hebrewdate-2.2.1.tar.gz:
Publisher:
python-publish.yml on Isaac-D20/hebrewdate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hebrewdate-2.2.1.tar.gz -
Subject digest:
ca9a6ce31d84d738fd3a296ae57d3abc51ba8621a02e51721510ed05768393f6 - Sigstore transparency entry: 775564986
- Sigstore integration time:
-
Permalink:
Isaac-D20/hebrewdate@ef123c0c1185f46cdbe9aa99467a956c2569b111 -
Branch / Tag:
refs/tags/v2.2.1 - Owner: https://github.com/Isaac-D20
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@ef123c0c1185f46cdbe9aa99467a956c2569b111 -
Trigger Event:
release
-
Statement type:
File details
Details for the file hebrewdate-2.2.1-py3-none-any.whl.
File metadata
- Download URL: hebrewdate-2.2.1-py3-none-any.whl
- Upload date:
- Size: 15.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bdf4cc77e65c3235b4cb0751a618f6448fc7b840a7c815a18e2ed7bc8b3497eb
|
|
| MD5 |
403fae8124c872a5bcd22aba823c19ee
|
|
| BLAKE2b-256 |
e6b191a46833a867d264d046a4ace93af0a57a5059ee7cbe772569df42c350e6
|
Provenance
The following attestation bundles were made for hebrewdate-2.2.1-py3-none-any.whl:
Publisher:
python-publish.yml on Isaac-D20/hebrewdate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hebrewdate-2.2.1-py3-none-any.whl -
Subject digest:
bdf4cc77e65c3235b4cb0751a618f6448fc7b840a7c815a18e2ed7bc8b3497eb - Sigstore transparency entry: 775564990
- Sigstore integration time:
-
Permalink:
Isaac-D20/hebrewdate@ef123c0c1185f46cdbe9aa99467a956c2569b111 -
Branch / Tag:
refs/tags/v2.2.1 - Owner: https://github.com/Isaac-D20
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@ef123c0c1185f46cdbe9aa99467a956c2569b111 -
Trigger Event:
release
-
Statement type: