| Copyright | (C) 2017 Jason Johnson |
|---|---|
| License | BSD-style (see the file LICENSE) |
| Maintainer | Jason Johnson <jason.johnson.081@gmail.com> |
| Stability | experimental |
| Portability | POSIX, Windows |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Data.HodaTime.Calendar.Hebrew
Description
This is the module for CalendarDate and CalendarDateTime in the Hebrew (Jewish) calendar, a lunisolar calendar that keeps its lunar months in step with the solar year by inserting a thirteenth
month (AdarI) seven times in each nineteen-year Metonic cycle (in years 3, 6, 8, 11, 14, 17 and 19). A common year has twelve months and a leap year thirteen; two of the months (Cheshvan and
Kislev) can independently gain or lose a day so that the year comes out to one of six permitted lengths (353/354/355 days common, 383/384/385 leap). The year number changes at 1 Tishri (Rosh
Hashanah), and dates share the same absolute timeline as every other calendar.
Month numbering: civil vs. scriptural
There are two traditional ways to number the Hebrew months, and — as with the Islamic leap patterns — the calendar is parameterised over the choice at the type level so that a date always records which
convention it uses and the type system refuses to mix the two. The choice does not change the underlying calendar at all (the months, their lengths and the day a given date falls on are identical); it only
changes which ordinal number fromEnum / toEnum assign to each month:
- Civil (the default) counts from
Tishri, the month of Rosh Hashanah at which the year number turns over. This is the numbering used by the .NETHebrewCalendarand is the natural one for most software: Tishri = 1, Cheshvan = 2, … , with the leap monthAdarIfalling in the middle of the sequence in a leap year. - Scriptural (biblical/ecclesiastical) counts from
Nisan, the "first month" of the Exodus. Nisan = 1, Iyar = 2, … , Tishri = 7, and the leap monthAdarIis numbered last (afterShevat), keeping the numbers of the other twelve months fixed between common and leap years.
The month constructors are shared across both conventions (the parameter is phantom for storage), so Nisan is the same month either way — only its Enum number differs. Each convention has a type
synonym, HebrewCivil and HebrewScriptural, and HebrewCivil is the default.
The two Adars
In a common year there is a single month Adar. A leap year inserts an extra month, AdarI (Adar Rishon), before it; the original Adar then plays the role of "Adar II" (Adar Sheni) and still
carries Purim. So Adar is present every year and AdarI exists only in leap years — attempting to build a date in AdarI in a common year yields Nothing, exactly as an out-of-range day or year does.
Synopsis
- calendarDate :: DayOfMonth -> Month HebrewCivil -> Year -> Maybe (CalendarDate HebrewCivil)
- fromNthDay :: DayNth -> DayOfWeek HebrewCivil -> Month HebrewCivil -> Year -> Maybe (CalendarDate HebrewCivil)
- fromWeekDate :: WeekNumber -> DayOfWeek HebrewCivil -> Year -> Maybe (CalendarDate HebrewCivil)
- calendarDate' :: DayOfMonth -> Month (Hebrew n) -> Year -> Maybe (CalendarDate (Hebrew n))
- fromNthDay' :: KnownNumbering n => DayNth -> DayOfWeek (Hebrew n) -> Month (Hebrew n) -> Year -> Maybe (CalendarDate (Hebrew n))
- fromWeekDate' :: WeekNumber -> DayOfWeek (Hebrew n) -> Year -> Maybe (CalendarDate (Hebrew n))
- data Hebrew (n :: MonthNumbering)
- data MonthNumbering
- = Civil
- | Scriptural
- data family Month cal
- data family DayOfWeek cal
- class KnownNumbering (n :: MonthNumbering)
- type HebrewCivil = Hebrew 'Civil
- type HebrewScriptural = Hebrew 'Scriptural
Constructors (default civil calendar)
calendarDate :: DayOfMonth -> Month HebrewCivil -> Year -> Maybe (CalendarDate HebrewCivil) Source #
fromNthDay :: DayNth -> DayOfWeek HebrewCivil -> Month HebrewCivil -> Year -> Maybe (CalendarDate HebrewCivil) Source #
Smart constructor for the default civil calendar given as a day relative to a month (e.g. the third Monday).
Returns Nothing if the resulting date is invalid.
fromWeekDate :: WeekNumber -> DayOfWeek HebrewCivil -> Year -> Maybe (CalendarDate HebrewCivil) Source #
Constructors (choose the numbering)
calendarDate' :: DayOfMonth -> Month (Hebrew n) -> Year -> Maybe (CalendarDate (Hebrew n)) Source #
fromNthDay' :: KnownNumbering n => DayNth -> DayOfWeek (Hebrew n) -> Month (Hebrew n) -> Year -> Maybe (CalendarDate (Hebrew n)) Source #
As fromNthDay, but in either numbering (chosen by the result type).
fromWeekDate' :: WeekNumber -> DayOfWeek (Hebrew n) -> Year -> Maybe (CalendarDate (Hebrew n)) Source #
As fromWeekDate, but in either numbering (chosen by the result type).
Types
data Hebrew (n :: MonthNumbering) Source #
The Hebrew (Jewish) calendar, parameterised by its month-numbering convention (see MonthNumbering).
Instances
data MonthNumbering Source #
The two conventions for numbering the Hebrew months, used as the (kind-MonthNumbering) type parameter of Hebrew
(see the module header).
Constructors
| Civil | |
| Scriptural |
data family Month cal Source #
Instances
data family DayOfWeek cal Source #
Instances
class KnownNumbering (n :: MonthNumbering) Source #
Reflects a MonthNumbering down to the calendar-order index at which it begins counting months: civil starts at
Tishri (0) and scriptural at Nisan (7). Read it via TypeApplications, e.g. .numberingStart @Civil
Minimal complete definition
numberingStart
Instances
| KnownNumbering 'Civil Source # | |
Defined in Data.HodaTime.Calendar.Hebrew Methods | |
| KnownNumbering 'Scriptural Source # | |
Defined in Data.HodaTime.Calendar.Hebrew Methods | |
Named calendars (month-numbering type synonyms)
type HebrewCivil = Hebrew 'Civil Source #
The Hebrew calendar numbered from Tishri (the .NET HebrewCalendar convention). This is the default.
type HebrewScriptural = Hebrew 'Scriptural Source #
The Hebrew calendar numbered from Nisan (the biblical / ecclesiastical convention).