Elixir Jalaali calendar

Build StatusHex.pmGitHub licenseGitHub issues

Elixir implementation of jalaali.js which contains a Calendar implementation for jalaali and some functions for converting Jalaali and Gregorian calendar systems to each other.

Installation

You can install jalaali by Addding it to your list of dependencies in mix.exs:

def deps do
  [{:jalaali, "~> 0.2.1"}]
end

Usage (Elixir >= 1.5)

After installing jalaali package. you can create Dates/DateTimes in jalaali or convert Dates/DateTimes form other calendars back an forth.

This feature is intruduced in Elixir 1.5 so in any versions below 1.5 the Date and DateTime modules lack functions for converting calendars. However you can just copy those modules but its just better to migrate to 1.5

How to use

Thats super easy. :)

Usage (Elixir < 1.5) [Old bad way]

&ast;IMPORTANT&ast; Do not use these methods if you can migrate to Elixir 1.5

After installing jalaali package. you can use it for:

  jal_date = Jalaali.to_jalaali(~D[2015-02-29])
  gre_date = Jalaali.to_gregorian(~D[1395-03-15])
  Jalaali.is_leap_jalaali_year(1395)
  true
  Jalaali.jalaali_month_length(1395, 12)
  30

License

This project is license under MIT.

For more information please check LICENSE