ESpec v1.7.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
day()
View Source
day()
View Source
day() :: 1..31
day() :: 1..31
Link to this type
month()
View Source
month()
View Source
month() :: 1..12
month() :: 1..12
Link to this type
year()
View Source
year()
View Source
year() :: 0..9999
year() :: 0..9999
Link to this section Functions
Link to this function
days_in_month(year, month) View Source
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
Link to this function
naive_datetime_to_iso_days(year, month, day, hour, minute, second, microsecond)
View Source
naive_datetime_to_iso_days(year, month, day, hour, minute, second, microsecond)
View Source
naive_datetime_to_iso_days(
Calendar.year(),
Calendar.month(),
Calendar.day(),
Calendar.hour(),
Calendar.minute(),
Calendar.second(),
Calendar.microsecond()
) :: Calendar.iso_days()
naive_datetime_to_iso_days( Calendar.year(), Calendar.month(), Calendar.day(), Calendar.hour(), Calendar.minute(), Calendar.second(), Calendar.microsecond() ) :: Calendar.iso_days()
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
time_to_day_fraction(hour, minute, second, arg)
View Source
time_to_day_fraction(
Calendar.hour(),
Calendar.minute(),
Calendar.second(),
Calendar.microsecond()
) :: Calendar.day_fraction()
time_to_day_fraction( Calendar.hour(), Calendar.minute(), Calendar.second(), Calendar.microsecond() ) :: Calendar.day_fraction()
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}