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.
It offers four main classes:
HebrewDate: Represents a specific date in the Hebrew calendar, with support for conversions to/from Gregorian dates, manipulation of dates (e.g., adding or subtracting days, months, or years), and various date-related attributes such as day, month, year, and weekday in the Hebrew calendar.HebrewYear: Represents a Hebrew year, managing leap year calculations, month lengths, and determining the first weekday of the year.HebrewCalendar: Extends Python's built-inCalendarclass to provide Hebrew calendar functionality, including methods for iterating over month days and converting between Hebrew and Gregorian dates.HTMLHebrewCalendar: Provides HTML formatting of Hebrew calendar data with support for both Hebrew and Gregorian date display, selection layers for holidays, festive days, and fasts, custom CSS styling.
Key Features:
- Conversion between Hebrew and Gregorian dates.
- Support for Hebrew holidays, festive days, and fasts.
- Computation of weekdays, month lengths, and leap years for Hebrew dates.
- Operations for date arithmetic, such as adding and subtracting days, months, and years.
- Methods for getting today's Hebrew date or constructing a Hebrew date from a Gregorian date.
- Calendar iteration and formatting for Hebrew dates in HTML format.
- Generate HTML calendars with customizable styling.
- Support for generating complete calendar pages for months and years.
Limitations:
- Supported Python versions: 3.9 and later
- Date conversions before 1752 CE may be inaccurate due to historical and calendar system variations.
- Dates far in the past may not be convertible to Gregorian dates
Installation
pip install hebrewdate
Usage
>>> from hebrewdate import HebrewDate, HTMLHebrewCalendar
# Get today's Hebrew date
>>> today = HebrewDate.today()
>>> print(today)
e.g. יום ראשון א ניסן ה'תשפ"ה
# Convert to Gregorian
>>> print(today.to_gregorian())
e.g. 2025-03-30
# Convert from Gregorian to Hebrew
>>> h = HebrewDate.from_gregorian(13, 4, 2025)
# Check holiday
>>> if h.is_holiday:
... print(pesach.holiday)
...
יו"ט ראשון של פסח
# Generate an HTML calendar
cal = HTMLHebrewCalendar(with_gregorian=False)
html = cal.formatmonth(5785, 1) # תשרי ה'תשפ"ה
Contribution
Contributions are welcome! Feel free to submit a Pull Request.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Author
Isaac Dovolsky © 2025
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.0.1.tar.gz.
File metadata
- Download URL: hebrewdate-2.0.1.tar.gz
- Upload date:
- Size: 16.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79ba065f087e58abaa11b9b7d454f060b53f4caf5608432b9a0be5ab92438326
|
|
| MD5 |
315ddf9f836a79df27db054c8df4c410
|
|
| BLAKE2b-256 |
db9b90b62a22f2a7b3d6d48aa1924fe24e900779a5a68a004849da1f277fc2c4
|
Provenance
The following attestation bundles were made for hebrewdate-2.0.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.0.1.tar.gz -
Subject digest:
79ba065f087e58abaa11b9b7d454f060b53f4caf5608432b9a0be5ab92438326 - Sigstore transparency entry: 252292578
- Sigstore integration time:
-
Permalink:
Isaac-D20/hebrewdate@83b25dd382b35d42fdff23895dd9b1235178fba9 -
Branch / Tag:
refs/tags/v2.0.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@83b25dd382b35d42fdff23895dd9b1235178fba9 -
Trigger Event:
release
-
Statement type:
File details
Details for the file hebrewdate-2.0.1-py3-none-any.whl.
File metadata
- Download URL: hebrewdate-2.0.1-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d56d9af3d5a064d1c8c8cd06fdbe85f85731c48417dfef622b3093feb6dc9d94
|
|
| MD5 |
862bf0c8d266c6a021b3b8229a519fdf
|
|
| BLAKE2b-256 |
2565535696fc65384f1b4db2fb9049c78d88a9d9f674fb85c22fef43346628b9
|
Provenance
The following attestation bundles were made for hebrewdate-2.0.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.0.1-py3-none-any.whl -
Subject digest:
d56d9af3d5a064d1c8c8cd06fdbe85f85731c48417dfef622b3093feb6dc9d94 - Sigstore transparency entry: 252292607
- Sigstore integration time:
-
Permalink:
Isaac-D20/hebrewdate@83b25dd382b35d42fdff23895dd9b1235178fba9 -
Branch / Tag:
refs/tags/v2.0.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@83b25dd382b35d42fdff23895dd9b1235178fba9 -
Trigger Event:
release
-
Statement type: