Safe Haskell | Safe-Inferred |
---|
Functions for converting Jalaali and Gregorian calendar systems.
- toJalaali :: GregorianYear -> GregorianMonth -> GregorianDay -> JalaaliDate
- toGregorian :: JalaaliYear -> JalaaliMonth -> JalaaliDay -> GregorianDate
- isValidJalaaliDate :: JalaaliYear -> JalaaliMonth -> JalaaliDay -> Bool
- isJalaaliLeapYear :: JalaaliYear -> Bool
- jalaaliMonthLength :: JalaaliYear -> JalaaliMonth -> Int
- jalCal :: JalaaliYear -> (LeapOffset, GregorianYear, DayInMarch)
- j2d :: JalaaliYear -> JalaaliMonth -> JalaaliDay -> JulianDayNumber
- d2j :: JulianDayNumber -> JalaaliDate
- g2d :: GregorianYear -> GregorianMonth -> GregorianDay -> JulianDayNumber
- d2g :: JulianDayNumber -> GregorianDate
- type JalaaliYear = Int
- type JalaaliMonth = Int
- type JalaaliDay = Int
- type GregorianYear = Int
- type GregorianMonth = Int
- type GregorianDay = Int
- type JulianDayNumber = Int
- type DayInMarch = Int
- type LeapOffset = Int
- type JalaaliDate = (JalaaliYear, JalaaliMonth, JalaaliDay)
- type GregorianDate = (GregorianYear, GregorianMonth, GregorianDay)
Documentation
toJalaali :: GregorianYear -> GregorianMonth -> GregorianDay -> JalaaliDateSource
Converts a Gregorian date to Jalaali.
toGregorian :: JalaaliYear -> JalaaliMonth -> JalaaliDay -> GregorianDateSource
Converts a Jalaali date to Gregorian.
isValidJalaaliDate :: JalaaliYear -> JalaaliMonth -> JalaaliDay -> BoolSource
Checks whether a Jalaali date is valid or not.
isJalaaliLeapYear :: JalaaliYear -> BoolSource
Is this a leap year or not?
jalaaliMonthLength :: JalaaliYear -> JalaaliMonth -> IntSource
Number of days in a given month in a Jalaali year.
jalCal :: JalaaliYear -> (LeapOffset, GregorianYear, DayInMarch)Source
This function determines if the Jalaali (Persian) year is leap (366-day long) or is the common year (365 days), and finds the day in March (Gregorian calendar) of the first day of the Jalaali year (jy).
param jy Jalaali calendar year (-61 to 3177)
return
leap: number of years since the last leap year (0 to 4)
gy: Gregorian year of the beginning of Jalaali year
march: the March day of Farvardin the 1st (1st day of jy)
see: http:www.astro.uni.torun.pl~kbPapersEMPPersianC-EMP.htm
see: http:www.fourmilab.chdocumentscalendar/
j2d :: JalaaliYear -> JalaaliMonth -> JalaaliDay -> JulianDayNumberSource
Converts a date of the Jalaali calendar to the Julian Day number.
param jy Jalaali year (1 to 3100)
param jm Jalaali month (1 to 12)
param jd Jalaali day (1 to 29/31)
return Julian Day number
d2j :: JulianDayNumber -> JalaaliDateSource
Converts the Julian Day number to a date in the Jalaali calendar.
param jdn Julian Day number
return
jy: Jalaali year (1 to 3100)
jm: Jalaali month (1 to 12)
jd: Jalaali day (1 to 29/31)
g2d :: GregorianYear -> GregorianMonth -> GregorianDay -> JulianDayNumberSource
Calculates the Julian Day number from Gregorian or Julian calendar dates. This integer number corresponds to the noon of the date (i.e. 12 hours of Universal Time). The procedure was tested to be good since 1 March, -100100 (of both calendars) up to a few million years into the future.
param gy Calendar year (years BC numbered 0, -1, -2, ...)
param gm Calendar month (1 to 12)
param gd Calendar day of the month (1 to 282930/31)
return Julian Day number
d2g :: JulianDayNumber -> GregorianDateSource
Calculates Gregorian and Julian calendar dates from the Julian Day number (jdn) for the period since jdn=-34839655 (i.e. the year -100100 of both calendars) to some millions years ahead of the present.
param jdn Julian Day number
return
gy: Calendar year (years BC numbered 0, -1, -2, ...)
gm: Calendar month (1 to 12)
gd: Calendar day of the month M (1 to 282930/31)
type JalaaliYear = IntSource
An Int representing a Jalaali year.
type JalaaliMonth = IntSource
An Int representing a Jalaali month (1-based).
type JalaaliDay = IntSource
An Int representing a Jalaali day.
type GregorianYear = IntSource
An Int representing a Gregorian year.
type GregorianMonth = IntSource
An Int representing a Gregorian month (1-based).
type GregorianDay = IntSource
An Int representing a Gregorian day.
type JulianDayNumber = IntSource
An Int representing a Julian Day Number
type DayInMarch = IntSource
An Int representing the day in March when converting a Jalaali year to Gregorian.
type LeapOffset = IntSource
An Int representing number of years since the last leap year.
type JalaaliDate = (JalaaliYear, JalaaliMonth, JalaaliDay)Source
A tuple for a Jalaali date.
type GregorianDate = (GregorianYear, GregorianMonth, GregorianDay)Source
A tuple for a Gregorian date.