Skip to content

Releases: elixir-cldr/cldr_calendars_persian

Cldr Calendars Persian version 1.1.0

06 Jul 02:40
Compare
Choose a tag to compare

Enhancements

  • Re-implemented Cldr.Calendar.Persian using use Cldr.Calendar.Behaviour. The code is easier to understand and, as a byproduct, any new callbacks are generally automatically taken care of.

Cldr Calendars Persian version 1.0.1

05 Sep 21:09
Compare
Choose a tag to compare

Bug Fixes

  • Add callbacks for Calendar.iso_days_to_beginning_of_day/1 and Calendar.iso_days_to_end_of_day/1.

Cldr Calendars Persian version 1.0.0

28 Apr 01:59
Compare
Choose a tag to compare

Enhancements

Cldr Calendars Persian version 0.4.0

08 Jun 03:03
Compare
Choose a tag to compare

Bug Fixes

  • Add additional callbacks for Cldr.Calendar required since ex_cldr_calendars version 1.8.

  • Make :dev dependencies optional

Cldr Calendars Persian version 0.3.0

21 May 19:57
Compare
Choose a tag to compare

Bug Fixes

  • Remove warnings for Elixir 1.12

Cldr Calendars Persian version 0.2.0

18 Mar 10:53
Compare
Choose a tag to compare

Bug Fixes

  • Update Cldr.Calendar.Persian.day_of_week/3 to be Cldr.Calendar.Persian.day_of_week/4 as required by Elixir 1.10.

Cldr Calendars Persian version 0.1.0

09 Dec 09:23
Compare
Choose a tag to compare

This library implements the Solar Hijri calendar that is used in Iran and Afghanistan.

From wikipedia:

The Solar Hijri calendar (Persian: گاه‌شماری هجری خورشیدی‎, romanized: gāh-shomāri-ye hejri-ye khorshidi; Pashto: لمريز لېږدیز کلیز‎), also called the Solar Hejri calendar or Shamsi Hijri calendar, and abbreviated as SH, is the official calendar of Iran and Afghanistan. It begins on the March equinox (Nowruz) as determined by astronomical calculation for the Iran Standard Time meridian (52.5°E, UTC+03:30) and has years of 365 or 366 days.

Usage

ex_cldr_calendars_persian conforms to both the Calendar and Cldr.Calendar behaviours and therefore the functions in the Date, DateTime, NaiveDateTime, Time and Calendar functions are supported.

For Elixir versions up to and including 1.9, a date can be created by:

iex> {:ok, date} = Date.new(1354, 1, 1, Cldr.Calendar.Persian)
{:ok, ~D[1354-01-01 Cldr.Calendar.Persian]}

For Elixir version 1.10 and later Sigil_D supports user-defined calendars:

iex> ~D[1354-01-01 Cldr.Calendar.Persian]
~D[1354-01-01 Cldr.Calendar.Persian]

Localization

ex_cldr_calendars_persian depends on ex_cldr_calendars which supports calendar localization. For full date and time formatting see ex_cldr_dates_times.

Basic localization is executed by the Cldr.Calendar.localize/3. For example:

iex> Cldr.Calendar.localize(date, :month, locale: "en")
"Farvardin"

iex> Cldr.Calendar.localize(date, :month, locale: "fa")
"فروردین"

iex> Cldr.Calendar.localize(date, :day_of_week, locale: "fa")
"جمعه"

iex> Cldr.Calendar.localize(date, :day_of_week, locale: "en")
"Fri"