Releases: elixir-cldr/cldr_calendars_persian
Cldr Calendars Persian version 1.1.0
Cldr Calendars Persian version 1.0.1
Bug Fixes
- Add callbacks for
Calendar.iso_days_to_beginning_of_day/1
andCalendar.iso_days_to_end_of_day/1
.
Cldr Calendars Persian version 1.0.0
Enhancements
- Updates to ex_cldr version 2.37.0 which includes data from CLDR release 43.
Cldr Calendars Persian version 0.4.0
Bug Fixes
-
Add additional callbacks for
Cldr.Calendar
required sinceex_cldr_calendars
version 1.8. -
Make :dev dependencies optional
Cldr Calendars Persian version 0.3.0
Bug Fixes
- Remove warnings for Elixir 1.12
Cldr Calendars Persian version 0.2.0
Bug Fixes
- Update
Cldr.Calendar.Persian.day_of_week/3
to beCldr.Calendar.Persian.day_of_week/4
as required by Elixir 1.10.
Cldr Calendars Persian version 0.1.0
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"