jalaali: Convert Jalaali and Gregorian calendar systems to each other

[ library, mit, time ] [ Propose Tags ]

A few Haskell functions for converting Jalaali (Jalali, Persian, Khayyami, Khorshidi, Shamsi) and Gregorian calendar systems to each other.


[Skip to Readme]

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0, 0.2.0, 1.0.0.0
Dependencies base (>=4.6 && <4.7) [details]
License MIT
Author Behrang Noruzi Niya
Maintainer behrangn@gmail.com
Category Math
Home page https://github.com/jalaali/jalaali-hs
Source repo head: git clone git://github.com/jalaali/jalaali-hs.git
Uploaded by behrang at 2014-08-04T10:03:57Z
Distributions LTSHaskell:1.0.0.0, NixOS:1.0.0.0, Stackage:1.0.0.0
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 1937 total (15 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Successful builds reported [all 1 reports]

Readme for jalaali-0.2.0

[back to package description]

Jalaali Haskell

A few Haskell functions for converting Jalaali (Jalali, Persian, Khayyami, Khorshidi, Shamsi) and Gregorian calendar systems to each other.

About

Jalali calendar is a solar calendar that was used in Persia, variants of which today are still in use in Iran as well as Afghanistan. Read more on Wikipedia or see Calendar Converter.

Calendar conversion is based on the algorithm provided by Kazimierz M. Borkowski and has a very good performance.

API

Types

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)

Functions

toJalaali

Converts a Gregorian date to Jalaali.

toJalaali :: GregorianYear -> GregorianMonth -> GregorianDay -> JalaaliDate

toGregorian

Converts a Jalaali date to Gregorian.

toGregorian :: JalaaliYear -> JalaaliMonth -> JalaaliDay -> GregorianDate

isValidJalaaliDate

Checkes whether a Jalaali date is valid or not.

isValidJalaaliDate :: JalaaliYear -> JalaaliMonth -> JalaaliDay -> Bool

isJalaaliLeapYear

Checks whether a Jalaali year is leap or not.

isJalaaliLeapYear :: JalaaliYear -> Bool

jalaaliMonthLength

Returns the number of days in a Jalaali year and month.

jalaaliMonthLength :: JalaaliYear -> JalaaliMonth -> Int

jalCal

Determines if a Jalaali year is leap or common, and finds the day in March of the first day of the Jalaali year.

jalCal :: JalaaliYear -> (LeapOffset, GregorianYear, DayInMarch)

j2d

Converts a Jalaali date to Julian Day number.

j2d :: JalaaliYear -> JalaaliMonth -> JalaaliDay -> JulianDayNumber

d2j

Converts a Julian Day number to a Jalaali date.

d2j :: JulianDayNumber -> JalaaliDate

g2d

Converts a Gregorian date to Julian Day number.

g2d :: GregorianYear -> GregorianMonth -> GregorianDay -> JulianDayNumber

d2g

Converts a Julian Day number to a Gregorian date.

d2g :: JulianDayNumber -> GregorianDate

License

MIT