ESpec v1.6.0 Calendar.ISO.Extension View Source

A module to extend the calendar implementation that follows to ISO8601 with methods found in Elixir 1.5.1. This is to allow ESpec to support Elixir >= 1.3.4 more easily.

Link to this section Summary

Functions

Returns how many days there are in the given year-month

Returns the t:Calendar.iso_days format of the specified date

Returns the normalized day fraction of the specified time

Link to this section Types

Link to this type month() View Source
month() :: 1..12
Link to this type year() View Source
year() :: 0..9999

Link to this section Functions

Link to this function days_in_month(year, month) View Source
days_in_month(year(), month()) :: 28..31

Returns how many days there are in the given year-month.

Examples

iex> Calendar.ISO.days_in_month(1900, 1)
31
iex> Calendar.ISO.days_in_month(1900, 2)
28
iex> Calendar.ISO.days_in_month(2000, 2)
29
iex> Calendar.ISO.days_in_month(2001, 2)
28
iex> Calendar.ISO.days_in_month(2004, 2)
29
iex> Calendar.ISO.days_in_month(2004, 4)
30
Link to this function leap_year?(year) View Source
leap_year?(year()) :: boolean()
Link to this function naive_datetime_to_iso_days(year, month, day, hour, minute, second, microsecond) View Source

Returns the t:Calendar.iso_days format of the specified date.

Examples

iex> Calendar.ISO.naive_datetime_to_iso_days(0, 1, 1, 0, 0, 0, {0, 6})
{0, {0, 86400000000}}
iex> Calendar.ISO.naive_datetime_to_iso_days(2000, 1, 1, 12, 0, 0, {0, 6})
{730485, {43200000000, 86400000000}}
iex> Calendar.ISO.naive_datetime_to_iso_days(2000, 1, 1, 13, 0, 0, {0, 6})
{730485, {46800000000, 86400000000}}
Link to this function time_to_day_fraction(hour, minute, second, arg) View Source

Returns the normalized day fraction of the specified time.

Examples

iex> Calendar.ISO.time_to_day_fraction(0, 0, 0, {0, 6})
{0, 86400000000}
iex> Calendar.ISO.time_to_day_fraction(12, 34, 56, {123, 6})
{45296000123, 86400000000}