Elixir v1.3.2 Calendar.ISO
A calendar implementation that follows to ISO8601.
This calendar implements the proleptic Gregorian calendar and is therefore compatible with the calendar used in most countries today. The proleptic means the Gregorian rules for leap years are applied for all time, consequently the dates give different results before the year 1583 from when the Gregorian calendar was adopted.
Summary
Functions
Builds and validates an ISO date
Returns if the given year is a leap year
Converts the given structure into a string
Functions
Builds and validates an ISO date.
Examples
iex> Calendar.ISO.date(2000, 1, 1)
{:ok, ~D[2000-01-01]}
iex> Calendar.ISO.date(2000, 13, 1)
{:error, :invalid_date}
iex> Calendar.ISO.date(2000, 2, 29)
{:ok, ~D[2000-02-29]}
iex> Calendar.ISO.date(2000, 2, 30)
{:error, :invalid_date}
iex> Calendar.ISO.date(2001, 2, 29)
{:error, :invalid_date}
Returns if the given year is a leap year.
Examples
iex> Calendar.ISO.leap_year?(2000)
true
iex> Calendar.ISO.leap_year?(2001)
false
iex> Calendar.ISO.leap_year?(2004)
true
iex> Calendar.ISO.leap_year?(1900)
false