### firstweekday property Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Gets or sets the starting weekday for the calendar weeks. ```APIDOC ## *property* firstweekday ### Description Get and set the weekday the weeks should start with. ### Return type int ``` -------------------------------- ### firstweekday Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Gets and sets the weekday on which weeks begin. ```APIDOC ## firstweekday ### Description Get and set the weekday the weeks should start with. ### Return type: int ``` -------------------------------- ### Get Date as Dictionary Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Returns the date components (year, month, day) as a dictionary. ```python date_instance.dict() ``` -------------------------------- ### iterweekdays() Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Returns an iterator for the weekdays, starting with the configured first weekday of the week. ```APIDOC ## iterweekdays() ### Description Return one week of weekday numbers. The numbers start with the configured first one. ### Method Iterator ### Yields * `int` – The next weekday with 1-7 for Sunday - Shabbos. The iterator starts with the `HebrewCalendar` object’s configured first weekday ie. if configured to start with Monday it will first yield 2 and end with 1. ``` -------------------------------- ### Hebrew Calendar Month Operations Source: https://github.com/simlist/pyluach/blob/master/docs/index.md Demonstrates how to get month names in English or Hebrew and how to navigate between months within a Hebrew year. Useful for calendar generation and display. ```python >>> month = hebrewcal.Month(5781, 10) >>> month.month_name() 'Teves' >>> month.month_name(True) 'טבת' >>> month + 3 Month(5781, 1) >>> for month in hebrewcal.Year(5774).itermonths(): ... print(month.month_name()) Tishrei Cheshvan ... ``` -------------------------------- ### Date Conversions and Comparisons Source: https://github.com/simlist/pyluach/blob/master/README.rst Demonstrates converting between Hebrew and Gregorian dates, performing date arithmetic, and comparing dates. Use `HebrewDate.today()` to get the current date. ```python >>> from pyluach import dates, hebrewcal, parshios >>> today = dates.HebrewDate.today() >>> lastweek_gregorian = (today - 7).to_greg() >>> lastweek_gregorian < today True >>> today - lastweek_gregorian 7 >>> greg = dates.GregorianDate(1986, 3, 21) >>> heb = dates.HebrewDate(5746, 13, 10) >>> greg == heb True ``` -------------------------------- ### Get ISO Weekday Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Returns the day of the week according to the ISO standard, where Monday is 1 and Sunday is 7. ```python date_instance.isoweekday() ``` -------------------------------- ### Get ISO Weekday Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Returns the day of the week according to the ISO standard, where Monday is 1 and Sunday is 7. ```python >>> heb_date = HebrewDate(5781, 3, 29) >>> heb_date.isoweekday() 6 ``` -------------------------------- ### iterweekdays Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Yields weekday numbers starting from the configured first weekday of the week. ```APIDOC ## iterweekdays() ### Description Return one week of weekday numbers. The numbers start with the configured first one. ### Yields: * `int` – The next weekday with 1-7 for Sunday - Shabbos. The iterator starts with the `HebrewCalendar` object’s configured first weekday ie. if configured to start with Monday it will first yield 2 and end with 1. ``` -------------------------------- ### Get Date as Dictionary Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Retrieves the year, month, and day of a date object as a dictionary. ```python >>> d = HebrewDate(5783, 12, 13) >>> d.dict() {'year': 5783, 'month': 12, 'day': 13} ``` -------------------------------- ### Hebrew Calendar Month and Year Iteration Source: https://github.com/simlist/pyluach/blob/master/README.rst Illustrates how to get month names in English and Hebrew, and iterate through months of a specific Hebrew year. The `+ 3` operation on a `Month` object demonstrates wrapping to the next year. ```python >>> month = hebrewcal.Month(5781, 10) >>> month.month_name() 'Teves' >>> month.month_name(True) 'טבת' >>> month + 3 Month(5781, 1) >>> for month in hebrewcal.Year(5774).itermonths(): ... print(month.month_name()) ... Tishrei Cheshvan ... ``` -------------------------------- ### Get Date as Tuple Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Retrieves the year, month, and day of a date object as a tuple of integers. ```python >>> d = HebrewDate(5783, 12, 13) >>> d.tuple() (5783, 12, 13) ``` -------------------------------- ### iterweekdays Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Returns an iterator for one week of weekday numbers, starting with the configured first weekday. ```APIDOC ## iterweekdays() ### Description Return one week of weekday numbers. The numbers start with the configured first one. ### Yields `int` – The next weekday with 1-7 for Sunday - Shabbos. The iterator starts with the `HebrewCalendar` object’s configured first weekday ie. if configured to start with Monday it will first yield 2 and end with 1. ``` -------------------------------- ### Get Next Shabbos Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Returns the Shabbos on or following the current date. The returned date is of the same type as the instance it's called on. ```python heb_date.shabbos() ``` ```python greg_date.shabbos() ``` -------------------------------- ### Get Fast Day Name Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Retrieves the name of a fast day for a given date. Optionally returns the name in Hebrew letters. ```python date_instance.fast_day(hebrew=False) ``` -------------------------------- ### Get Year Data for Formatting Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Retrieve year data structured for calendar formatting. Choose the data type based on desired output: HebrewDate objects, (day, weekday) tuples, or day numbers. ```python from pyluach.dates import HebrewDate year_data_dates = yeardatescalendar(2023) year_data_tuples = yeardays2calendar(2023) year_data_ints = yeardayscalendar(2023) ``` -------------------------------- ### Get Day of Week Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Obtains the day of the week as an integer, where Sunday is 1 and Saturday is 7. This method is useful for calculations or display logic based on the day of the week. ```python >>> date.weekday() 4 ``` -------------------------------- ### Get Fast Day Name Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Retrieve the name of a Jewish fast day for a given Hebrew date. Supports returning the name in Hebrew letters. ```python >>> taanis_esther = HebrewDate(5783, 12, 13) >>> taanis_esther.fast_day() 'Taanis Esther' >>> taanis_esther.fast_day(hebrew=True) 'תענית אסתר' ``` -------------------------------- ### Weekly Parsha Retrieval Source: https://github.com/simlist/pyluach/blob/master/README.rst Shows how to get the weekly Torah portion (Parsha) for a given Gregorian date, with options for English or Hebrew names, and specifying if the location is Israel. Note that some dates may correspond to multiple Parshios. ```python >>> date = dates.GregorianDate(2010, 10, 6) >>> parshios.getparsha(date) [0] >>> parshios.getparsha_string(date, israel=True) 'Beraishis' >>> parshios.getparsha_string(date, hebrew=True) 'בראשית' >>> new_date = dates.GregorianDate(2021, 3, 10) >>> parshios.getparsha_string(new_date) 'Vayakhel, Pekudei' >>> parshios.getparsha_string(new_date, hebrew=True) 'ויקהל, פקודי' ``` -------------------------------- ### Add Months with Previous Day Rounding Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Adds a specified number of months to a Hebrew date, using PREVIOUS_DAY rounding when the target month has fewer days than the starting day. ```python >>> date = HebrewDate(5783, 11, 30) >>> date.add(months=1, rounding=Rounding.PREVIOUS_DAY) HebrewDate(5783, 12, 29) ``` -------------------------------- ### HebrewHTMLCalendar Class Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Initializes a HebrewHTMLCalendar object, adapting calendar.HTMLCalendar for Hebrew dates. Allows customization of weekday start, numeral display, language for weekdays and months, year display, and right-to-left layout. ```APIDOC ## class pyluach.hebrewcal.HebrewHTMLCalendar(firstweekday=1, hebrewnumerals=True, hebrewweekdays=False, hebrewmonths=False, hebrewyear=False, rtl=False) ### Description Class to generate html calendars. Adapts `calendar.HTMLCalendar` for the Hebrew calendar. ### Parameters * **firstweekday** (*int*, *optional*) – The weekday to start each week with. Default is `1` for Sunday. * **hebrewnumerals** (*bool*, *optional*) – Default is `True`, which shows the days of the month with Hebrew numerals. `False` shows the days of the month as a decimal number. * **hebrewweekdays** (*bool*, *optional*) – `True` to show the weekday in Hebrew. Default is `False`, which shows the weekday in English. * **hebrewmonths** (*bool*, *optional*) – `True` to show the month name in Hebrew. Default is `False`, which shows the month name transliterated into English. * **hebrewyear** (*bool*, *optional*) – `True` to show the year in Hebrew numerals. Default is `False`, which shows the year as a decimal number. * **rtl** (*bool*, *optional*) – `True` to arrange the months and the days of the month from right to left. Default is `False`. ``` -------------------------------- ### Convert Hebrew Date to Gregorian and Find Shabbos Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Demonstrates converting a Hebrew date to a Gregorian date and finding the next Shabbos for both. Requires importing HebrewDate and GregorianDate. ```python >>> heb_date = HebrewDate(5781, 3, 29) >>> greg_date = heb_date.to_greg() >>> heb_date.shabbos() HebrewDate(5781, 4, 2) >>> greg_date.shabbos() GregorianDate(2021, 6, 12) ``` -------------------------------- ### Get Current Hebrew Date Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Retrieves the current Hebrew date based on the system's timestamp. This static method is a convenient way to get today's date in the Hebrew calendar. ```python >>> HebrewDate.today() HebrewDate(5783, 1, 15) ``` -------------------------------- ### Hebrew Date Formatting Source: https://github.com/simlist/pyluach/blob/master/README.rst Shows how to format Hebrew dates into strings, including day, month, and year, with options for including the 'H' prefix for the year. ```python >>> purim = dates.HebrewDate(5781, 12, 14) >>> purim.hebrew_day() 'י״ד' >>> purim.hebrew_date_string() 'י״ד אדר תשפ״א' >>> purim.hebrew_date_string(True) 'י״ד אדר ה׳תשפ״א' ``` -------------------------------- ### Hebrew Date Conversions and Comparisons Source: https://github.com/simlist/pyluach/blob/master/docs/index.md Demonstrates converting between Hebrew and Gregorian dates, performing date arithmetic, and comparing dates. Use for basic date manipulation and validation. ```python >>> from pyluach import dates, hebrewcal, parshios >>> today = dates.HebrewDate.today() >>> lastweek_gregorian = (today - 7).to_greg() >>> lastweek_gregorian < today True >>> today - lastweek_gregorian 7 >>> greg = dates.GregorianDate(1986, 3, 21) >>> heb = dates.HebrewDate(5746, 13, 10) >>> greg == heb True ``` -------------------------------- ### Formatting Hebrew Holidays Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Demonstrates how to create a HebrewDate object and format its corresponding holiday name in English and Hebrew, with an option to prefix the day of the week. ```python >>> from pyluach.dates import HebrewDate >>> pesach = HebrewDate(2023, 1, 15) >>> holiday(pesach, prefix_day=True) '1 Pesach' >>> holiday(pesach, hebrew=True, prefix_day=True) 'א׳ פסח' >>> taanis_esther = HebrewDate(5783, 12, 13) >>> holiday(taanis_esther, prefix_day=True) 'Taanis Esther' ``` -------------------------------- ### formatmonth(theyear, themonth, withyear=True) Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Generates a complete HTML table for a given month, with an option to include the year in the month name. ```APIDOC ## formatmonth(theyear, themonth, withyear=True) ### Description Return a formatted month as an html table. ### Parameters * **theyear** (*int*) * **themonth** (*int*) * **withyear** (*bool*, *optional*) – `True` to have the year appended to the month name. Default is `True`. ### Return type str ``` -------------------------------- ### Get Julian Day Number Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Returns the Julian day number for a Gregorian date at midnight. ```python >>> from pyluach.dates import GregorianDate >>> date = GregorianDate(2023, 10, 26) >>> date.jd 2460244.5 ``` -------------------------------- ### dict() Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Returns the date represented as a dictionary with year, month, and day components. ```APIDOC ## dict() ### Description Return the date as a dictionary. ### Returns A dictionary in the form `{'year': int, 'month': int, 'day': int}`. ### Return type dict ``` -------------------------------- ### Get Weekday Integer Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Returns the day of the week as an integer, with Sunday as 1 and Saturday as 7. ```python >>> heb_date = HebrewDate(5781, 3, 29) >>> heb_date.weekday() 7 ``` -------------------------------- ### HebrewDate Static Methods Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Provides static methods to create HebrewDate instances, such as from a Python date object or the current date. ```APIDOC #### from_pydate(pydate) Return a HebrewDate from a python date object. * **Parameters:** **pydate** (*datetime.date*) – A python standard library `datetime.date` instance * **Return type:** [HebrewDate](#pyluach.dates.HebrewDate) #### today() Return HebrewDate instance for the current day. This static method wraps the Python standard library’s `date.today()` method to get the date from the timestamp. * **Returns:** The current Hebrew date from the computer’s timestamp. * **Return type:** [HebrewDate](#pyluach.dates.HebrewDate) ``` -------------------------------- ### Format Hebrew Date String Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Demonstrates custom string formatting for a HebrewDate object using strftime-like directives. Ensure the HebrewDate object is initialized correctly. ```python >>> date = HebrewDate(5783, 1, 15) >>> f'Today is {date:%a - %*-d %*B, %*y}' 'Today is Thu - טו אייר, תשפ"ג' ``` -------------------------------- ### isoweekday() Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Returns the ISO standard day of the week, where Monday is 1 and Sunday is 7. ```APIDOC ## isoweekday() ### Description Return the day of the week corresponding to the iso standard. ### Returns An integer representing the day of the week where Monday is 1 and and Sunday is 7. ### Return type int ``` -------------------------------- ### Get Festival Name (Hebrew) Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Returns the name of a Jewish festival in Hebrew letters. Includes multi-day festivals with day prefixing. ```python >>> pesach = HebrewDate(2023, 1, 15) >>> pesach.festival(hebrew=True, prefix_day=True) 'א׳ פסח' ``` -------------------------------- ### Get Festival Name (English) Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Returns the name of a Jewish festival transliterated into English. Includes multi-day festivals with day prefixing. ```python >>> pesach = HebrewDate(2023, 1, 15) >>> pesach.festival(prefix_day=True) '1 Pesach' ``` ```python >>> shavuos = HebrewDate(5783, 3, 6) >>> shavuos.festival(israel=True, prefix_day=True) 'Shavuos' ``` -------------------------------- ### tuple Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Returns the date represented as a tuple of integers in the format (year, month, day). ```APIDOC ## tuple() ### Description Return date as tuple. ### Returns A tuple of ints in the form `(year, month, day)`. ### Return type tuple of ints ``` -------------------------------- ### to_pydate() Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Converts the current date to a standard Python datetime.date object. ```APIDOC ## to_pydate() ### Description Convert to a standard library date. ### Returns The equivalent datetime.date instance. ### Return type datetime.date ``` -------------------------------- ### Get Current Gregorian Date Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Retrieves the current Gregorian date. This method wraps Python's standard library date.today(). ```python GregorianDate.today() ``` -------------------------------- ### formatweekheader Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Generates a header string for a week. ```APIDOC ## formatweekheader(width) ### Description Return a header for a week. ### Parameters * **width** - Required ``` -------------------------------- ### Get Current Julian Day Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Returns a JulianDay object representing the current Julian day based on the system's timestamp. ```python >>> JulianDay.today() JulianDay(2460000.5) ``` -------------------------------- ### formatyear(theyear, width=3) Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Generates an HTML table for a given year, allowing specification of the number of months to display per row. ```APIDOC ## formatyear(theyear, width=3) ### Description Return a formatted year as an html table. ### Parameters * **theyear** (*int*) * **width** (*int*, *optional*) – The number of months to display per row. Default is 3. ### Return type str ``` -------------------------------- ### pyluach.parshios.four_parshios Source: https://github.com/simlist/pyluach/blob/master/docs/parshios.md Determines which of the four special parshios is designated for a given Shabbos date. The `hebrew` parameter can be set to `True` to get the name in Hebrew. ```APIDOC ## pyluach.parshios.four_parshios(date, hebrew=False) ### Description Return which of the four parshios is given date’s Shabbos. ### Parameters * **date** (*BaseDate*) – Any subclass of `BaseDate`. This date does not have to be a Shabbos. * **hebrew** (*bool*) – `True` if you want the name of the parsha in Hebrew. Default is `False`. ### Returns The name of the one of the four parshios or an empty string if that shabbos is not one of them. ### Return type str ``` -------------------------------- ### Get Month Name Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Retrieves the name of the Hebrew month. The `hebrew` parameter controls whether the name is returned in English transliteration or Hebrew characters. ```python >>> date.month_name() 'Tishrei' >>> date.month_name(hebrew=True) 'תשרי' ``` -------------------------------- ### prmonth Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Prints a formatted calendar for a specific month. ```APIDOC ## prmonth(theyear, themonth, w=0, l=0) ### Description Print a month’s calendar. ### Parameters: * **theyear** (int) - Required * **themonth** (int) - Required * **w** (int, optional) - Default is 0 * **l** (int, optional) - Default is 0 ``` -------------------------------- ### pryear Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Prints a formatted calendar for an entire year. ```APIDOC ## pryear(theyear, w=0, l=0, c=6, m=3) ### Description Print a year’s calendar. ### Parameters: * **theyear** (int) - Required * **w** (int, optional) - Default is 0 * **l** (int, optional) - Default is 0 * **c** (int, optional) - Default is 6 * **m** (int, optional) - Default is 3 ``` -------------------------------- ### Get Hebrew Date as Tuple Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Retrieves the Hebrew date components (year, month, day) as a tuple of integers. This is useful for programmatic access to the date parts. ```python >>> date.tuple() (5783, 1, 15) ``` -------------------------------- ### formatyearpage(theyear, width=3, css='calendar.css', encoding=None) Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Generates a complete HTML page for a given year, with options for layout width, CSS file, and encoding. ```APIDOC ## formatyearpage(theyear, width=3, css='calendar.css', encoding=None) ### Description Return a formatted year as a complete HTML page. ``` -------------------------------- ### Get Jewish Holiday Name Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Retrieves the name of a Jewish holiday for a given date, including fast days. Supports Israel schedule and Hebrew names. ```python pesach.holiday(prefix_day=True) ``` ```python pesach.holiday(hebrew=True, prefix_day=True) ``` ```python taanis_esther.holiday(prefix_day=True) ``` -------------------------------- ### today() Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Returns a GregorianDate instance for the current day by wrapping Python's date.today(). ```APIDOC ## today() ### Description Return a GregorianDate instance for the current day. This static method wraps the Python standard library’s date.today() method to get the date from the timestamp. ### Returns The current Gregorian date from the computer’s timestamp. ### Return type [GregorianDate](#pyluach.dates.GregorianDate) ``` -------------------------------- ### Get Jewish Festival Name Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Retrieves the name of a Jewish festival for a given date. Supports Israel schedule, Hebrew names, and inclusion of working days. ```python pesach.festival(prefix_day=True) ``` ```python pesach.festival(hebrew=True, prefix_day=True) ``` ```python shavuos.festival(israel=True, prefix_day=True) ``` -------------------------------- ### itermonthdays(year, month) Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Yields day numbers for a given month, similar to itermonthdates but returns integers. ```APIDOC ## itermonthdays(year, month) ### Description Like `itermonthdates()` but will yield day numbers. For days outside the specified month the day number is 0. ### Parameters #### Path Parameters * **year** (int) - Required - The year for which to retrieve days. * **month** (int) - Required - The Hebrew month starting with 1 for Nissan through 13 for Adar Sheni if necessary. ### Yields * `int` – The day of the month or 0 if the date is before or after the month. ``` -------------------------------- ### HebrewTextCalendar Constructor Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Initializes a HebrewTextCalendar object, which adapts TextCalendar for the Hebrew calendar with various formatting options. ```APIDOC ### *class* pyluach.hebrewcal.HebrewTextCalendar(firstweekday=1, hebrewnumerals=True, hebrewweekdays=False, hebrewmonths=False, hebrewyear=False) Bases: [`HebrewCalendar`](#pyluach.hebrewcal.HebrewCalendar), `TextCalendar` Subclass of HebrewCalendar that outputs a plaintext calendar. `HebrewTextCalendar` adapts `calendar.TextCalendar` for the Hebrew calendar. ### Parameters * **firstweekday** (int, optional) – The weekday to start each week with. Default is `1` for Sunday. * **hebrewnumerals** (bool, optional) – Default is `True`, which shows the days of the month with Hebrew numerals. `False` shows the days of the month as a decimal number. * **hebrewweekdays** (bool, optional) – `True` to show the weekday in Hebrew. Default is `False`, which shows the weekday in English. * **hebrewmonths** (bool, optional) – `True` to show the month name in Hebrew. Default is `False`, which shows the month name transliterated into English. * **hebrewyear** (bool, optional) – `True` to show the year in Hebrew numerals. Default is `False`, which shows the year as a decimal number. ``` -------------------------------- ### isoweekday Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Return the day of the week according to the ISO standard, where Monday is 1 and Sunday is 7. ```APIDOC ## isoweekday() ### Description Return the day of the week corresponding to the iso standard. ### Returns An integer representing the day of the week where Monday is 1 and and Sunday is 7. ### Return type int ``` -------------------------------- ### Get Jewish Holiday Name Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Retrieve the name of a Jewish holiday for a given Hebrew date. Supports options for Israel schedule, Hebrew names, and prefixing multi-day holidays. ```python >>> pesach = HebrewDate(2023, 1, 15) >>> pesach.holiday(prefix_day=True) '1 Pesach' >>> pesach.holiday(hebrew=True, prefix_day=True) 'א׳ פסח' >>> taanis_esther = HebrewDate(5783, 12, 13) >>> taanis_esther.holiday(prefix_day=True) 'Taanis Esther' ``` -------------------------------- ### formatmonth Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Returns a multi-line string representing a single month's calendar. ```APIDOC ## formatmonth(theyear, themonth, w=0, l=0) ### Description Return a month’s calendar string (multi-line). ### Parameters * **theyear** (int) - Required * **themonth** (int) - Required * **w** (int, optional) - Default is 0 * **l** (int, optional) - Default is 0 ``` -------------------------------- ### pyluach.hebrewcal.HebrewCalendar Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Represents a Hebrew calendar, extending Python's standard Calendar class. Allows customization of week start day, numeral display, and language for weekdays and months. ```APIDOC ## class pyluach.hebrewcal.HebrewCalendar(firstweekday=1, hebrewnumerals=True, hebrewweekdays=False, hebrewmonths=False, hebrewyear=False) ### Description Calendar base class. This class extends the python library `Calendar` class for the Hebrew calendar. The weekdays are 1 for Sunday through 7 for Shabbos. ### Parameters * **firstweekday** (*int*, optional) – The weekday to start each week with. Default is `1` for Sunday. * **hebrewnumerals** (*bool*, optional) – Default is `True`, which shows the days of the month with Hebrew numerals. `False` shows the days of the month as a decimal number. * **hebrewweekdays** (*bool*, optional) – `True` to show the weekday in Hebrew. Default is `False`, which shows the weekday in English. * **hebrewmonths** (*bool*, optional) – `True` to show the month name in Hebrew. Default is `False`, which shows the month name transliterated into English. * **hebrewyear** (*bool*, optional) – `True` to show the year in Hebrew numerals. Default is `False`, which shows the year as a decimal number. ``` -------------------------------- ### itermonthdays3(year, month) Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Returns an iterator for the year, month, and day of the month as tuples. ```APIDOC ## itermonthdays3(year, month) ### Description Return iterator for the year, month, and day of the month. ### Parameters #### Path Parameters * **year** (int) - Required - The year for which to retrieve year, month, and day. * **month** (int) - Required - The Hebrew month starting with 1 for Nissan through 13 for Adar Sheni if necessary. ### Yields * `tuple` of `int` – A tuple of ints in the form `(year, month, day)`. ``` -------------------------------- ### Get Weekly Parsha Name Source: https://github.com/simlist/pyluach/blob/master/docs/parshios.md Retrieve the English or Hebrew name of the weekly parsha for a given date. This function can also handle dates that are not Shabbos, returning the parsha for the upcoming Shabbos. ```python >>> from pyluach import dates, parshios >>> date = dates.HebrewDate(5781, 10, 5) >>> parshios.getparsha(date) 'Vayigash' >>> parshios.getparsha_string(date, hebrew=True) 'ויגש' >>> parshios.getparsha_string(dates.GregorianDate(2021, 3, 7), hebrew=True) 'ויקהל, פקודי' ``` -------------------------------- ### formatweek(theweek) Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Formats an entire week into an HTML table row. ```APIDOC ## formatweek(theweek) ### Description Return a complete week as a table row. ``` -------------------------------- ### formatyear Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Generates a multi-line string representing a full year's calendar. ```APIDOC ## formatyear(theyear, w=2, l=1, c=6, m=3) ### Description Returns a year’s calendar as a multi-line string. ### Parameters * **theyear** (int) - Required * **w** (int, optional) - The date column width. Default is 2 * **l** (int, optional) - The number of lines per week. Default is 1. * **c** (int, optional) - The number of columns in between each month. Default is 6 * **m** (int, optional) - The number of months per row. Default is 3. ### Return type: str ``` -------------------------------- ### add Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Adds years, months, and days to the current Hebrew date, with options for handling Adar and rounding. ```APIDOC ## add(years=0, months=0, days=0, adar1=False, rounding=Rounding.NEXT_DAY) ### Description Add years, months, and days to date. ### Parameters #### Query Parameters - **years** (int) - Optional - The number of years to add. Default is 0. - **months** (int) - Optional - The number of months to add. Default is 0. - **days** (int) - Optional - The number of days to add. Default is 0. - **adar1** (bool) - Optional - True to return a date in Adar Aleph if self is in a regular Adar and after adding the years it’s leap year. Default is `False` which will return the date in Adar Beis. - **rounding** (Rounding) - Optional - Choose what to do if self is the 30th day of the month, and there are only 29 days in the destination month. [`Rounding.NEXT_DAY`](#pyluach.dates.Rounding.NEXT_DAY) to return the first day of the next month. [`Rounding.PREVIOUS_DAY`](#pyluach.dates.Rounding.PREVIOUS_DAY) to return the last day of the month. [`Rounding.EXCEPTION`](#pyluach.dates.Rounding.EXCEPTION) to raise a ValueError. Default is [`Rounding.NEXT_DAY`](#pyluach.dates.Rounding.NEXT_DAY). ### NOTE This method first adds the years. If the starting month is Adar and the destination year has two Adars, it chooses which one based on the adar1 argument, then it adds the months. If the starting day doesn’t exist in that month it adjusts it based on the rounding argument, then it adds the days. ### Return type HebrewDate ### Examples ```pycon >>> date = HebrewDate(5783, 11, 30) >>> date.add(months=1) HebrewDate(5783, 1, 1) >>> date.add(months=1, rounding=Rounding.PREVIOUS_DAY) HebrewDate(5783, 12, 29) ``` ``` -------------------------------- ### shabbos() Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Returns the Shabbos on or following the current date, maintaining the original date type. ```APIDOC ## shabbos() ### Description Return the Shabbos on or following the date. ### Returns self if the date is Shabbos or else the following Shabbos as the same date type as called from. ### Return type [JulianDay](#pyluach.dates.JulianDay), [GregorianDate](#pyluach.dates.GregorianDate), or [HebrewDate](#pyluach.dates.HebrewDate) ### Examples ```pycon >>> heb_date = HebrewDate(5781, 3, 29) >>> greg_date = heb_date.to_greg() >>> heb_date.shabbos() HebrewDate(5781, 4, 2) >>> greg_date.shabbos() GregorianDate(2021, 6, 12) ``` ``` -------------------------------- ### Get Festival Name for a Hebrew Date Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Shows how to retrieve the name of a Jewish festival for a given Hebrew date. Supports options for Israel schedule, Hebrew names, including working days, and prefixing the day number. Requires importing HebrewDate. ```python >>> pesach = HebrewDate(2023, 1, 15) >>> pesach.festival(prefix_day=True) '1 Pesach' >>> pesach.festival(hebrew=True, prefix_day=True) 'א׳ פסח' >>> shavuos = HebrewDate(5783, 3, 6) >>> shavuos.festival(israel=True, prefix_day=True) 'Shavuos' ``` -------------------------------- ### HebrewDate Initialization Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Initializes a HebrewDate object with the specified year, month, and day. The Julian day can optionally be provided but should not be assigned manually. ```APIDOC ## HebrewDate(year, month, day, jd=None) ### Description A class for manipulating Hebrew dates. ### Parameters * **year** (*int*) – The Hebrew year. * **month** (*int*) – The Hebrew month starting with Nissan as 1 (and Tishrei as 7). If there is a second Adar in the year it is has a value of 13. * **day** (*int*) – The Hebrew day of the month. * **jd** (*float*, optional) – This parameter should not be assigned manually. ``` -------------------------------- ### replace(year=None, month=None, day=None) Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Returns a new date object with specified year, month, or day values replaced. ```APIDOC ## replace(year=None, month=None, day=None) ### Description Return new date with new values for the specified field. ### Parameters #### Parameters * **year** (*int* *,* *optional*) * **month** (*int* *,* *optional*) * **day** (*int* *,* *optional*) ### Returns * *CalendarDateMixin* – Any date that inherits from CalendarDateMixin (`GregorianDate`, `HebrewDate`). * *Raises* * *ValueError* – Raises a `ValueError` if the new date does not exist. ``` -------------------------------- ### to_heb() Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Converts the current date to its Hebrew date equivalent. ```APIDOC ## to_heb() ### Description Convert to Hebrew date. ### Returns The equivalent HebrewDate instance. ### Return type [HebrewDate](#pyluach.dates.HebrewDate) ``` -------------------------------- ### formatweekheader() Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Generates the HTML table row for the week header. ```APIDOC ## formatweekheader() ### Description Return a header for a week as a table row. ``` -------------------------------- ### fast_day(hebrew=False) Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Retrieves the name of a fast day for the given date, with an option for Hebrew names. ```APIDOC ## fast_day(hebrew=False) ### Description Return name of fast day of date. ### Parameters #### Parameters - **hebrew** (*bool* *,* *optional*) – `True` if you want the fast day name in Hebrew letters. Default is `False`, which returns the name transliterated into English. ### Returns The name of the fast day or `None` if the date is not a fast day. ### Return type str or None ``` -------------------------------- ### holiday(israel=False, hebrew=False, prefix_day=False) Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Returns the name of a Jewish holiday for the given date, including fast days, with options for Israel schedule, Hebrew names, and prefixing the day. ```APIDOC ## holiday(israel=False, hebrew=False, prefix_day=False) ### Description Return name of Jewish holiday of the date. The holidays include the major and minor religious Jewish holidays including fast days. ### Parameters #### Parameters * **israel** (*bool* *,* *optional*) – `True` if you want the holidays according to the Israel schedule. Defaults to `False`. * **hebrew** (*bool* *,* *optional*) – `True` if you want the holiday name in Hebrew letters. Default is `False`, which returns the name transliterated into English. * **prefix_day** (*bool* *,* *optional*) – `True` to prefix multi day holidays with the day of the holiday. Default is `False`. ### Returns The name of the holiday or `None` if the given date is not a Jewish holiday. ### Return type str or None ### Examples ```pycon >>> pesach = HebrewDate(2023, 1, 15) >>> pesach.holiday(prefix_day=True) '1 Pesach' >>> pesach.holiday(hebrew=True, prefix_day=True) 'א׳ פסח' >>> taanis_esther = HebrewDate(5783, 12, 13) >>> taanis_esther.holiday(prefix_day=True) 'Taanis Esther' ``` ``` -------------------------------- ### tuple() Method Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Returns the Hebrew date as a tuple of integers representing the year, month, and day. ```APIDOC #### tuple() Return date as tuple. * **Returns:** A tuple of ints in the form `(year, month, day)`. * **Return type:** tuple of ints ``` -------------------------------- ### Format Hebrew Day with Geresh Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Returns the day of the month in Hebrew letters, including a geresh for single digits and gershayim for two-digit numbers. Defaults to including geresh/gershayim. ```python >>> date = HebrewDate(5782, 3, 6) >>> date.hebrew_day() 'ו׳' ``` ```python >>> HebrewDate(5783, 12, 14).hebrew_day() 'י״ד' ``` -------------------------------- ### Convert Date to Python Standard Date Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Converts a date instance to a standard Python datetime.date object. ```python date_instance.to_pydate() ``` -------------------------------- ### monthdatescalendar(year, month) Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Returns a matrix (list of lists) of HebrewDate objects for a given month's calendar. ```APIDOC ## monthdatescalendar(year, month) ### Description Return matrix (list of lists) of dates for month’s calendar. Each row represents a week; week entries are HebrewDate instances. ### Parameters #### Path Parameters * **year** (int) - Required - The year of the month. * **month** (int) - Required - The Hebrew month starting with 1 for Nissan through 13 for Adar Sheni if necessary. ### Returns * `list` of list of [`pyluach.dates.HebrewDate`](dates.md#pyluach.dates.HebrewDate) – List of weeks in the month containing 7 `HebrewDate` instances each. ``` -------------------------------- ### itermonthdays3(year, month) Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Yields tuples of (year, month, day) for a specified Hebrew month, iterating through complete weeks. ```APIDOC ## itermonthdays3(year, month) ### Description Return iterator for the year, month, and day of the month. ### Parameters * **year** (*int*) * **month** (*int*) ### Yields `tuple` of `int` – A tuple of ints in the form `(year, month, day)`. ``` -------------------------------- ### pyluach.dates.BaseDate.shabbos Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Returns the Shabbos on or following the date. If the date is Shabbos, it returns the date itself. ```APIDOC ## shabbos() ### Description Return the Shabbos on or following the date. ### Returns - self if the date is Shabbos or else the following Shabbos as the same date type as called from. - **Return type:** [JulianDay](#pyluach.dates.JulianDay), [GregorianDate](#pyluach.dates.GregorianDate), or [HebrewDate](#pyluach.dates.HebrewDate) ``` -------------------------------- ### to_jd() Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Converts the current date to its Julian day equivalent. ```APIDOC ## to_jd() ### Description Convert to a Julian day. ### Returns The equivalent JulianDay instance. ### Return type [JulianDay](#pyluach.dates.JulianDay) ``` -------------------------------- ### shabbos Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Return the Shabbos on or following the current date. If the current date is Shabbos, it returns the current date; otherwise, it returns the next Shabbos. ```APIDOC ## shabbos() ### Description Return the Shabbos on or following the date. ### Returns self if the date is Shabbos or else the following Shabbos as the same date type as called from. ### Return type [JulianDay](#pyluach.dates.JulianDay), [GregorianDate](#pyluach.dates.GregorianDate), or [HebrewDate](#pyluach.dates.HebrewDate) ### Examples ```pycon >>> heb_date = HebrewDate(5781, 3, 29) >>> greg_date = heb_date.to_greg() >>> heb_date.shabbos() HebrewDate(5781, 4, 2) >>> greg_date.shabbos() GregorianDate(2021, 6, 12) ``` ``` -------------------------------- ### weekday() Method Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Returns the day of the week as an integer, where Sunday is 1 and Saturday is 7. ```APIDOC #### weekday() Return day of week as an integer. * **Returns:** An integer representing the day of the week with Sunday as 1 through Saturday as 7. * **Return type:** int ``` -------------------------------- ### formatweekday(day) Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Formats a given weekday into an HTML table header. Accepts an integer representing the day of the week. ```APIDOC ## formatweekday(day) ### Description Return a weekday name as an html table header. ### Parameters **day** (*int*) – The day of the week 1-7 with Sunday as 1 and Shabbos as 7. ### Return type str ``` -------------------------------- ### Replace Date Components Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Creates a new date instance with specified year, month, or day. Raises ValueError if the new date is invalid. ```python date_instance.replace(year=2024, month=7, day=15) ``` -------------------------------- ### itermonthdays2(year, month) Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Yields tuples of (day of month, weekday) for a specified Hebrew month, iterating through complete weeks. ```APIDOC ## itermonthdays2(year, month) ### Description Return iterator for the days and weekdays of the month. ### Parameters * **year** (*int*) * **month** (*int*) ### Yields `tuple` of `int` – A tuple of ints in the form `(day of month, weekday)`. ``` -------------------------------- ### formatday(day, weekday) Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Formats a given day of the month into an HTML table cell. Handles days within or outside the specified month. ```APIDOC ## formatday(day, weekday) ### Description Return a day as an html table cell. ### Parameters * **day** (*int*) – The day of the month or zero for a day outside the month. * **weekday** (*int*) – The weekday with 1 as Sunday through 7 as Shabbos. ### Return type str ``` -------------------------------- ### Create Gregorian Date from Python Date Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Creates a `GregorianDate` instance from a standard Python `datetime.date` object. ```python >>> import datetime >>> from pyluach.dates import GregorianDate >>> py_date = datetime.date(2023, 10, 26) >>> gregorian_date = GregorianDate.from_pydate(py_date) >>> gregorian_date GregorianDate(2023, 10, 26) ``` -------------------------------- ### formatmonthname Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Formats the name of a Hebrew month, optionally including the year. ```APIDOC ## formatmonthname(theyear, themonth, width=0, withyear=True) ### Description Returns formatted month name. ### Parameters * **theyear** (int) - Required * **themonth** (int) - Required - 1-12 or 13 for Nissan-Adar Sheni * **width** (int, optional) - The number of columns per day. Default is 0 * **withyear** (bool, optional) - Default is `True` to include the year with the month name. ### Return type: str ``` -------------------------------- ### pyluach.dates.BaseDate.isoweekday Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Returns the day of the week corresponding to the ISO standard, where Monday is 1 and Sunday is 7. ```APIDOC ## isoweekday() ### Description Returns the day of the week corresponding to the ISO standard. ### Returns - An integer representing the day of the week where Monday is 1 and and Sunday is 7. - **Return type:** int ``` -------------------------------- ### itermonthdays4(year, month) Source: https://github.com/simlist/pyluach/blob/master/docs/hebrewcal.md Returns an iterator for the year, month, day, and weekday as tuples. ```APIDOC ## itermonthdays4(year, month) ### Description Return iterator for the year, month, day, and weekday. ### Parameters #### Path Parameters * **year** (int) - Required - The year for which to retrieve year, month, day, and weekday. * **month** (int) - Required - The Hebrew month starting with 1 for Nissan through 13 for Adar Sheni if necessary. ### Yields * `tuple` of `int` – A tuple of ints in the form `(year, month, day, weekday)`. ``` -------------------------------- ### Format Hebrew Date String Source: https://github.com/simlist/pyluach/blob/master/docs/dates.md Returns a string representation of the Hebrew date in the format 'day month year'. Defaults to not including the thousands prefix for the year. ```python >>> date = HebrewDate(5781, 9, 25) >>> date.hebrew_date_string() 'כ״ה כסלו תשפ״א' ```