Skip to main content

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

hebrewdate-2.2.1.tar.gz (20.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hebrewdate-2.2.1-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

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

Hashes for hebrewdate-2.2.1.tar.gz
Algorithm Hash digest
SHA256 ca9a6ce31d84d738fd3a296ae57d3abc51ba8621a02e51721510ed05768393f6
MD5 5259fa3e44dfe832f521ebf90cc6818f
BLAKE2b-256 9c2f11757fecc60ccf68a7367739b1c766491205a7cc1f667281a52b9906e58c

See more details on using hashes here.

Provenance

The following attestation bundles were made for hebrewdate-2.2.1.tar.gz:

Publisher: python-publish.yml on Isaac-D20/hebrewdate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for hebrewdate-2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bdf4cc77e65c3235b4cb0751a618f6448fc7b840a7c815a18e2ed7bc8b3497eb
MD5 403fae8124c872a5bcd22aba823c19ee
BLAKE2b-256 e6b191a46833a867d264d046a4ace93af0a57a5059ee7cbe772569df42c350e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for hebrewdate-2.2.1-py3-none-any.whl:

Publisher: python-publish.yml on Isaac-D20/hebrewdate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page