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.0.tar.gz (20.7 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.0-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file hebrewdate-2.2.0.tar.gz.

File metadata

  • Download URL: hebrewdate-2.2.0.tar.gz
  • Upload date:
  • Size: 20.7 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.0.tar.gz
Algorithm Hash digest
SHA256 3dcdd8aa3763c2e62603a344b5c1502f5b16cc4f7037a7f4edb308bfd043fa4e
MD5 6b84f61db1b08262f7167f7068fea3a3
BLAKE2b-256 87bb2d3c0e6b3bca81027599dd3a89b21fae00bd571e5670e7f97026ed9625f8

See more details on using hashes here.

Provenance

The following attestation bundles were made for hebrewdate-2.2.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: hebrewdate-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 15.6 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f3cbe8577133baa0902e54bc1f8ce51e647b7e896d2eb537ddfa282b10b4339f
MD5 36cfabfb9eca600797327b990a2b6f1f
BLAKE2b-256 27ade0013945136d5a0d399d2433bd001f039e54b59dd70e05a8d2ffa68e8af9

See more details on using hashes here.

Provenance

The following attestation bundles were made for hebrewdate-2.2.0-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