Chinese (Calendars v0.2.4) View Source

The Chinese calendar module.

Link to this section Summary

Functions

Adds the number of days to a fixed day or Chinese date.

Returns a fixed day or Chinese date as a Chinese date.

Returns a fixed day or Chinese date as a fixed day.

Returns a fixed day or Chinese date either as a fixed day or a Chinese date.

Returns the fixed date of Chinese New Year of the Chinese calendar in the given gregorian_year or [], if there is no such holiday in that year.

Compares two Chinese dates and returns...

Returns the cycle field of a Chinese date.

Returns a Chinese date from its fields cycle, year, month, leap, day.

Returns the difference (= number of days) between two Chinese dates.

Returns the day field of a Chinese date.

Returns the fixed date of Dragon Festival of the Chinese calendar in the given gregorian_year or [], if there is no such holiday in that year.

Returns the epoch of the Chinese calendar.

Returns true if Chinese date1 is equal Chinese date2, otherwise false.

Returns the name of the field atom in a Chinese date at field_index.

Returns a list of the field atoms (names) of a Chinese date.

Returns the number of fields in a Chinese date

Returns the index (= position) of the field_atom in a Chinese date.

Converts the other_date of the other_calendar into the equivalent date of the Chinese calendar.

Converts a fixed day to a Chinese date.

Converts a Julian Day into the equivalent Chinese date.

Converts a RataDie date into the equivalent Chinese date.

Converts a Unix date into the equivalent Chinese date.

Returns true if Chinese date1 is greater (= later) than or equal Chinese date2, otherwise false.

Returns true if Chinese date1 is greater (= later) than Chinese date2, otherwise false.

Returns a list of the holidays of the Chinese calendar.

Returns the internal keyword of the Chinese calendar.

Returns true if Chinese date1 is smaller (= earlier) than or equal Chinese date2, otherwise false.

Returns the leap field of a Chinese date.

Returns true if Chinese date1 is smaller (= earlier) than Chinese date2, otherwise false.

Returns the module of the Chinese calendar.

Returns the month field of a Chinese date.

Returns the internal name of the Chinese calendar.

Returns the fixed date of Qingming of the Chinese calendar in the given gregorian_year or [], if there is no such holiday in that year.

Returns the distance between two Chinese dates as a range of fixed days.

Returns the start of the day in the Chinese calendar.

Converts a Chinese date into the equivalent date of the other_calendar.

Converts a Chinese date tuple into a fixed day.

Converts a Chinese date given by cycle, year, month, leap, day into a fixed day.

Converts a Chinese date into the equivalent Julian Day.

Converts a Chinese date given by cycle, year, month, leap, day into the equivalent Julian Day.

Converts a Chinese date into the equivalent RataDie date.

Converts a Chinese date given by cycle, year, month, leap, day into the equivalent RataDie date.

Converts a Chinese date into the equivalent Unix date.

Converts a Chinese date given by cycle, year, month, leap, day into the equivalent Unix date.

Returns the current date either as a fixed day or a Chinese date.

Returns the year field of a Chinese date.

Link to this section Types

Specs

chinese_cycle() :: integer()

Specs

Specs

chinese_day() :: 1..31

Specs

chinese_leap() :: boolean()

Specs

chinese_month() :: 1..12

Specs

chinese_year() :: 1..60

Specs

fixed() :: integer()

Specs

t() :: chinese_date()

Link to this section Functions

Link to this function

add_days(cal_date, days, type \\ :fixed)

View Source

Specs

add_days(fixed() | chinese_date(), integer(), :fixed | :date) ::
  fixed() | chinese_date()

Adds the number of days to a fixed day or Chinese date.

If days is negative, the days will be subtracted.

The type parameter determines the type of the returned value:

  • :fixed returns a fixed day (default),
  • :date returns a Chinese date.

Examples

  iex>Elixir.Chinese.add_days(730739, 100)
  730839
  iex>Elixir.Chinese.add_days(730739, -100)
  730639

  iex>Elixir.Chinese.add_days(730739, 100, :fixed)
  730839
  iex>Elixir.Chinese.add_days(730739, -100, :fixed)
  730639

  iex>Elixir.Chinese.add_days(730739, 100, :date)
  {78, 18, 11, false, 6}
  iex>Elixir.Chinese.add_days(730739, -100, :date)
  {78, 18, 4, true, 12}

  iex>Elixir.Chinese.add_days({78, 18, 7, false, 24}, 100)
  730839
  iex>Elixir.Chinese.add_days({78, 18, 7, false, 24}, -100)
  730639

  iex>Elixir.Chinese.add_days({78, 18, 7, false, 24}, 100, :fixed)
  730839
  iex>Elixir.Chinese.add_days({78, 18, 7, false, 24}, -100, :fixed)
  730639

  iex>Elixir.Chinese.add_days({78, 18, 7, false, 24}, 100, :date)
  {78, 18, 11, false, 6}
  iex>Elixir.Chinese.add_days({78, 18, 7, false, 24}, -100, :date)
  {78, 18, 4, true, 12}

Specs

as_date(fixed() | chinese_date()) :: chinese_date()

Returns a fixed day or Chinese date as a Chinese date.

This is a convenience function to simplify certain function calls.

Examples

  iex>Elixir.Chinese.as_date(730739)
  {78, 18, 7, false, 24}
  iex>Elixir.Chinese.as_date({78, 18, 7, false, 24})
  {78, 18, 7, false, 24}

Specs

as_fixed(fixed() | chinese_date()) :: fixed()

Returns a fixed day or Chinese date as a fixed day.

This is a convenience function to simplify certain function calls.

Examples

  iex>Elixir.Chinese.as_fixed(730739)
  730739
  iex>Elixir.Chinese.as_fixed({78, 18, 7, false, 24})
  730739
Link to this function

as_type(cal_date, type \\ :fixed)

View Source

Specs

as_type(fixed() | chinese_date(), :fixed | :date) :: fixed() | chinese_date()

Returns a fixed day or Chinese date either as a fixed day or a Chinese date.

The type parameter determines the type of the returned value:

  • :fixed returns a fixed day (default),
  • :date returns a Chinese date.

Examples

  iex>Elixir.Chinese.as_type(730739)
  730739
  iex>Elixir.Chinese.as_type(730739, :fixed)
  730739
  iex>Elixir.Chinese.as_type(730739, :date)
  {78, 18, 7, false, 24}
  iex>Elixir.Chinese.as_type({78, 18, 7, false, 24})
  730739
  iex>Elixir.Chinese.as_type({78, 18, 7, false, 24}, :fixed)
  730739
  iex>Elixir.Chinese.as_type({78, 18, 7, false, 24}, :date)
  {78, 18, 7, false, 24}
Link to this function

chinese_new_year(gregorian_year)

View Source

Specs

chinese_new_year(Gregorian.gregorian_year()) :: fixed() | chinese_date()

Returns the fixed date of Chinese New Year of the Chinese calendar in the given gregorian_year or [], if there is no such holiday in that year.

The type parameter determines the type of the returned value:

  • :fixed returns a fixed day (default),
  • :date returns a Chinese date.

Example

  iex>Elixir.Chinese.chinese_new_year(2001)
  {2001, 1, 24}

Specs

compare(chinese_date(), chinese_date()) :: :lt | :eq | :gt

Compares two Chinese dates and returns...

  • :lt if date1 is smaller (= earlier) than date2,
  • :eq if date1 is equal date2,
  • :gt if date1 is larger (= later) than date2.

Examples

  iex>Elixir.Chinese.compare({78, 18, 7, false, 24}, {78, 18, 7, false, 24})
  :eq
  iex>Elixir.Chinese.compare({78, 18, 7, false, 24}, {78, 18, 11, false, 6})
  :lt
  iex>Elixir.Chinese.compare({78, 18, 11, false, 6}, {78, 18, 7, false, 24})
  :gt
Link to this function

cycle(cal_date, type \\ :value)

View Source

Specs

cycle(fixed() | chinese_date(), :atom | :index | :name | :value) ::
  :atom | integer() | String.t() | number()

Returns the cycle field of a Chinese date.

The type parameter determines the type of the returned cycle:

  • :atom returns the internal name of cycle,
  • :index returns the position of the cycle field within the date,
  • :name returns the common name of the cycle,
  • :value returns the value of the cycle (default).

Examples

  iex>Elixir.Chinese.cycle(730739)
  78
  iex>Elixir.Chinese.cycle(730739, :atom)
  :cycle
  iex>Elixir.Chinese.cycle(730739, :index)
  0
  iex>Elixir.Chinese.cycle(730739, :name)
  "Cycle"
  iex>Elixir.Chinese.cycle(730739, :value)
  78

  iex>Elixir.Chinese.cycle({78, 18, 7, false, 24})
  78
  iex>Elixir.Chinese.cycle({78, 18, 7, false, 24}, :atom)
  :cycle
  iex>Elixir.Chinese.cycle({78, 18, 7, false, 24}, :index)
  0
  iex>Elixir.Chinese.cycle({78, 18, 7, false, 24}, :name)
  "Cycle"
  iex>Elixir.Chinese.cycle({78, 18, 7, false, 24}, :value)
  78
Link to this function

date(cycle, year, month, leap, day)

View Source

Specs

Returns a Chinese date from its fields cycle, year, month, leap, day.

Example

  iex>Elixir.Chinese.date(78, 18, 7, false, 24)
  {78, 18, 7, false, 24}
Link to this function

date_diff(cal_date1, cal_date2)

View Source

Specs

date_diff(fixed() | chinese_date(), fixed() | chinese_date()) :: integer()

Returns the difference (= number of days) between two Chinese dates.

The dates can be given as fixed days or Chinese dates in arbitrary combination. The difference is calculated by date2 - date1.

If cal_date2 is larger (= later) than cal_date1 the result is positive.

If cal_date2 is smaller (= earlier) than cal_date1 the result is negative.

Examples

  iex>Elixir.Chinese.date_diff(730739, 730839)
  100
  iex>Elixir.Chinese.date_diff(730839, 730739)
  -100
  iex>Elixir.Chinese.date_diff({78, 18, 7, false, 24}, {78, 18, 11, false, 6})
  100
  iex>Elixir.Chinese.date_diff({78, 18, 11, false, 6}, {78, 18, 7, false, 24})
  -100
  iex>Elixir.Chinese.date_diff(730739, {78, 18, 11, false, 6})
  100
  iex>Elixir.Chinese.date_diff({78, 18, 7, false, 24}, 730839)
  100
Link to this function

day(cal_date, type \\ :value)

View Source

Specs

day(fixed() | chinese_date(), :atom | :index | :name | :value) ::
  :atom | integer() | String.t() | number()

Returns the day field of a Chinese date.

The type parameter determines the type of the returned day:

  • :atom returns the internal name of day,
  • :index returns the position of the day field within the date,
  • :name returns the common name of the day,
  • :value returns the value of the day (default).

Examples

  iex>Elixir.Chinese.day(730739)
  24
  iex>Elixir.Chinese.day(730739, :atom)
  :day
  iex>Elixir.Chinese.day(730739, :index)
  4
  iex>Elixir.Chinese.day(730739, :name)
  "Day"
  iex>Elixir.Chinese.day(730739, :value)
  24

  iex>Elixir.Chinese.day({78, 18, 7, false, 24})
  24
  iex>Elixir.Chinese.day({78, 18, 7, false, 24}, :atom)
  :day
  iex>Elixir.Chinese.day({78, 18, 7, false, 24}, :index)
  4
  iex>Elixir.Chinese.day({78, 18, 7, false, 24}, :name)
  "Day"
  iex>Elixir.Chinese.day({78, 18, 7, false, 24}, :value)
  24
Link to this function

dragon_festival(gregorian_year)

View Source

Specs

dragon_festival(Gregorian.gregorian_year()) :: fixed() | chinese_date()

Returns the fixed date of Dragon Festival of the Chinese calendar in the given gregorian_year or [], if there is no such holiday in that year.

The type parameter determines the type of the returned value:

  • :fixed returns a fixed day (default),
  • :date returns a Chinese date.

Example

  iex>Elixir.Chinese.dragon_festival(2001)
  {2001, 6, 25}

Specs

epoch() :: number()

Returns the epoch of the Chinese calendar.

Example

  iex>Elixir.Chinese.epoch()
  -963099

Specs

Returns true if Chinese date1 is equal Chinese date2, otherwise false.

Examples

  iex>Elixir.Chinese.eq({78, 18, 7, false, 24}, {78, 18, 7, false, 24})
  true
  iex>Elixir.Chinese.eq({78, 18, 7, false, 24}, {78, 18, 11, false, 6})
  false
  iex>Elixir.Chinese.eq({78, 18, 11, false, 6}, {78, 18, 7, false, 24})
  false

Specs

field_atom(integer()) :: atom()

Returns the name of the field atom in a Chinese date at field_index.

Examples

  iex>Elixir.Chinese.field_atom(0)
  :cycle
  iex>Elixir.Chinese.field_atom(1)
  :year
  iex>Elixir.Chinese.field_atom(2)
  :month
  iex>Elixir.Chinese.field_atom(3)
  :leap
  iex>Elixir.Chinese.field_atom(4)
  :day

Specs

field_atoms() :: [atom()]

Returns a list of the field atoms (names) of a Chinese date.

Example

  iex>Elixir.Chinese.field_atoms()
  [:cycle, :year, :month, :leap, :day]

Specs

field_count() :: integer()

Returns the number of fields in a Chinese date

Example

  iex>Elixir.Chinese.field_count()
  5

Specs

field_index(atom()) :: integer()

Returns the index (= position) of the field_atom in a Chinese date.

Examples

  iex>Elixir.Chinese.field_index(:cycle)
  0
  iex>Elixir.Chinese.field_index(:year)
  1
  iex>Elixir.Chinese.field_index(:month)
  2
  iex>Elixir.Chinese.field_index(:leap)
  3
  iex>Elixir.Chinese.field_index(:day)
  4
Link to this function

from_date(other_date, other_calendar)

View Source

Specs

from_date(tuple(), module()) :: chinese_date()
from_date(tuple(), module()) :: {:error, String.t()}

Converts the other_date of the other_calendar into the equivalent date of the Chinese calendar.

Example

  iex>Elixir.Chinese.from_date({2001, 9, 11}, Gregorian)
  {78, 18, 7, false, 24}

Specs

from_fixed(fixed()) :: chinese_date()

Converts a fixed day to a Chinese date.

Example

  iex>Elixir.Chinese.from_fixed(730739)
  {78, 18, 7, false, 24}

Specs

from_jd(tuple() | number()) :: chinese_date()

Converts a Julian Day into the equivalent Chinese date.

The Julian Day can be given as a tuple or by a Julian day.

Examples

  iex>Elixir.Chinese.from_jd({2452163.5})
  {78, 18, 7, false, 24}
  iex>Elixir.Chinese.from_jd(2452163.5)
  {78, 18, 7, false, 24}

Specs

from_rata_die(tuple() | integer()) :: chinese_date()

Converts a RataDie date into the equivalent Chinese date.

The RataDie date can be given as a tuple or by a RataDie rd.

Examples

  iex>Elixir.Chinese.from_rata_die({730739})
  {78, 18, 7, false, 24}
  iex>Elixir.Chinese.from_rata_die(730739)
  {78, 18, 7, false, 24}

Specs

from_unix(tuple() | integer()) :: chinese_date()

Converts a Unix date into the equivalent Chinese date.

The Unix date can be given as a tuple or by Unix seconds.

Examples

  iex>Elixir.Chinese.from_unix({1000166400})
  {78, 18, 7, false, 24}
  iex>Elixir.Chinese.from_unix(1000166400)
  {78, 18, 7, false, 24}

Specs

Returns true if Chinese date1 is greater (= later) than or equal Chinese date2, otherwise false.

Examples

  iex>Elixir.Chinese.ge({78, 18, 7, false, 24}, {78, 18, 7, false, 24})
  true
  iex>Elixir.Chinese.ge({78, 18, 7, false, 24}, {78, 18, 11, false, 6})
  false
  iex>Elixir.Chinese.ge({78, 18, 11, false, 6}, {78, 18, 7, false, 24})
  true

Specs

Returns true if Chinese date1 is greater (= later) than Chinese date2, otherwise false.

Examples

  iex>Elixir.Chinese.gt({78, 18, 7, false, 24}, {78, 18, 7, false, 24})
  false
  iex>Elixir.Chinese.gt({78, 18, 7, false, 24}, {78, 18, 11, false, 6})
  false
  iex>Elixir.Chinese.gt({78, 18, 11, false, 6}, {78, 18, 7, false, 24})
  true

Returns a list of the holidays of the Chinese calendar.

The type parameter determines the type of the returned holidays:

  • :atom returns the internal names of the holidays,
  • :name returns the common names of the holidays (default).

Examples

  iex>Elixir.Chinese.holidays()
  ["Chinese New Year", "Qingming", "Dragon Festival"]
  iex>Elixir.Chinese.holidays(:atom)
  [:chinese_new_year, :qing_ming, :dragon_festival]
  iex>Elixir.Chinese.holidays(:name)
  ["Chinese New Year", "Qingming", "Dragon Festival"]

Specs

keyword() :: atom()

Returns the internal keyword of the Chinese calendar.

Example

  iex>Elixir.Chinese.keyword()
  :chinese

Specs

Returns true if Chinese date1 is smaller (= earlier) than or equal Chinese date2, otherwise false.

Examples

  iex>Elixir.Chinese.le({78, 18, 7, false, 24}, {78, 18, 7, false, 24})
  true
  iex>Elixir.Chinese.le({78, 18, 7, false, 24}, {78, 18, 11, false, 6})
  true
  iex>Elixir.Chinese.le({78, 18, 11, false, 6}, {78, 18, 7, false, 24})
  false
Link to this function

leap(cal_date, type \\ :value)

View Source

Specs

leap(fixed() | chinese_date(), :atom | :index | :name | :value) ::
  :atom | integer() | String.t() | number()

Returns the leap field of a Chinese date.

The type parameter determines the type of the returned leap:

  • :atom returns the internal name of leap,
  • :index returns the position of the leap field within the date,
  • :name returns the common name of the leap,
  • :value returns the value of the leap (default).

Examples

  iex>Elixir.Chinese.leap(730739)
  false
  iex>Elixir.Chinese.leap(730739, :atom)
  :leap
  iex>Elixir.Chinese.leap(730739, :index)
  3
  iex>Elixir.Chinese.leap(730739, :name)
  "Leap"
  iex>Elixir.Chinese.leap(730739, :value)
  false

  iex>Elixir.Chinese.leap({78, 18, 7, false, 24})
  false
  iex>Elixir.Chinese.leap({78, 18, 7, false, 24}, :atom)
  :leap
  iex>Elixir.Chinese.leap({78, 18, 7, false, 24}, :index)
  3
  iex>Elixir.Chinese.leap({78, 18, 7, false, 24}, :name)
  "Leap"
  iex>Elixir.Chinese.leap({78, 18, 7, false, 24}, :value)
  false

Specs

Returns true if Chinese date1 is smaller (= earlier) than Chinese date2, otherwise false.

Examples

  iex>Elixir.Chinese.lt({78, 18, 7, false, 24}, {78, 18, 7, false, 24})
  false
  iex>Elixir.Chinese.lt({78, 18, 7, false, 24}, {78, 18, 11, false, 6})
  true
  iex>Elixir.Chinese.lt({78, 18, 11, false, 6}, {78, 18, 7, false, 24})
  false

Specs

module() :: module()

Returns the module of the Chinese calendar.

Example

  iex>Elixir.Chinese.module()
  Chinese
Link to this function

month(cal_date, type \\ :value)

View Source

Specs

month(fixed() | chinese_date(), :atom | :index | :name | :value) ::
  :atom | integer() | String.t() | number()

Returns the month field of a Chinese date.

The type parameter determines the type of the returned month:

  • :atom returns the internal name of month,
  • :index returns the position of the month field within the date,
  • :name returns the common name of the month,
  • :value returns the value of the month (default).

Examples

  iex>Elixir.Chinese.month(730739)
  7
  iex>Elixir.Chinese.month(730739, :atom)
  :month
  iex>Elixir.Chinese.month(730739, :index)
  2
  iex>Elixir.Chinese.month(730739, :name)
  "Month"
  iex>Elixir.Chinese.month(730739, :value)
  7

  iex>Elixir.Chinese.month({78, 18, 7, false, 24})
  7
  iex>Elixir.Chinese.month({78, 18, 7, false, 24}, :atom)
  :month
  iex>Elixir.Chinese.month({78, 18, 7, false, 24}, :index)
  2
  iex>Elixir.Chinese.month({78, 18, 7, false, 24}, :name)
  "Month"
  iex>Elixir.Chinese.month({78, 18, 7, false, 24}, :value)
  7

Specs

name() :: atom()

Returns the internal name of the Chinese calendar.

Example

  iex>Elixir.Chinese.name()
  "Chinese"
Link to this function

qing_ming(gregorian_year)

View Source

Specs

Returns the fixed date of Qingming of the Chinese calendar in the given gregorian_year or [], if there is no such holiday in that year.

The type parameter determines the type of the returned value:

  • :fixed returns a fixed day (default),
  • :date returns a Chinese date.

Example

  iex>Elixir.Chinese.qing_ming(2001)
  {2001, 4, 5}

Specs

range(chinese_date(), chinese_date()) :: integer()

Returns the distance between two Chinese dates as a range of fixed days.

Example

  iex>Elixir.Chinese.range({78, 18, 7, false, 24}, {78, 18, 11, false, 6})
  730739..730839

Specs

start_of_day() :: :midnight | :sunset | :sunrise | :noon

Returns the start of the day in the Chinese calendar.

Possible return values are:

  • :midnight,
  • :noon,
  • :sunrise,
  • :sunset,

Example

  iex>Elixir.Chinese.start_of_day()
  :midnight
Link to this function

to_date(date, other_calendar)

View Source

Specs

to_date(chinese_date(), module()) :: tuple()

Converts a Chinese date into the equivalent date of the other_calendar.

For the following example to work the Gregorian calendar must be available.

Example

  iex>Elixir.Chinese.to_date({78, 18, 7, false, 24}, Gregorian)
  {2001, 9, 11}

Specs

to_fixed(chinese_date()) :: fixed()

Converts a Chinese date tuple into a fixed day.

Example

  iex>Elixir.Chinese.to_fixed({78, 18, 7, false, 24})
  730739
Link to this function

to_fixed(cycle, year, month, leap, day)

View Source

Specs

Converts a Chinese date given by cycle, year, month, leap, day into a fixed day.

Example

  iex>Elixir.Chinese.to_fixed(78, 18, 7, false, 24)
  730739

Specs

to_jd(chinese_date()) :: {number()}

Converts a Chinese date into the equivalent Julian Day.

Example

  iex>Elixir.Chinese.to_jd({78, 18, 7, false, 24})
  {2452163.5}
Link to this function

to_jd(cycle, year, month, leap, day)

View Source

Specs

Converts a Chinese date given by cycle, year, month, leap, day into the equivalent Julian Day.

Example

  iex>Elixir.Chinese.to_jd(78, 18, 7, false, 24)
  {2452163.5}

Specs

to_rata_die(chinese_date()) :: {integer()}

Converts a Chinese date into the equivalent RataDie date.

Example

  iex>Elixir.Chinese.to_rata_die({78, 18, 7, false, 24})
  {730739}
Link to this function

to_rata_die(cycle, year, month, leap, day)

View Source

Specs

Converts a Chinese date given by cycle, year, month, leap, day into the equivalent RataDie date.

Example

  iex>Elixir.Chinese.to_rata_die(78, 18, 7, false, 24)
  {730739}

Specs

to_unix(chinese_date()) :: {integer()}

Converts a Chinese date into the equivalent Unix date.

Example

  iex>Elixir.Chinese.to_unix({78, 18, 7, false, 24})
  {1000166400}
Link to this function

to_unix(cycle, year, month, leap, day)

View Source

Specs

Converts a Chinese date given by cycle, year, month, leap, day into the equivalent Unix date.

Example

  iex>Elixir.Chinese.to_unix(78, 18, 7, false, 24)
  {1000166400}

Specs

today(:fixed | :date) :: fixed() | chinese_date()

Returns the current date either as a fixed day or a Chinese date.

(This cannot be doctested, because today is a moving target.)

The type parameter determines the type of the returned value:

  • :fixed returns a fixed day (default),
  • :date returns a Chinese date.

Examples

  Elixir.Chinese.today()
  730739
  Elixir.Chinese.today(:fixed)
  730739
  Elixir.Chinese.today(:date)
  {78, 18, 7, false, 24}
Link to this function

year(cal_date, type \\ :value)

View Source

Specs

year(fixed() | chinese_date(), :atom | :index | :name | :value) ::
  :atom | integer() | String.t() | number()

Returns the year field of a Chinese date.

The type parameter determines the type of the returned year:

  • :atom returns the internal name of year,
  • :index returns the position of the year field within the date,
  • :name returns the common name of the year,
  • :value returns the value of the year (default).

Examples

  iex>Elixir.Chinese.year(730739)
  18
  iex>Elixir.Chinese.year(730739, :atom)
  :year
  iex>Elixir.Chinese.year(730739, :index)
  1
  iex>Elixir.Chinese.year(730739, :name)
  "Year"
  iex>Elixir.Chinese.year(730739, :value)
  18

  iex>Elixir.Chinese.year({78, 18, 7, false, 24})
  18
  iex>Elixir.Chinese.year({78, 18, 7, false, 24}, :atom)
  :year
  iex>Elixir.Chinese.year({78, 18, 7, false, 24}, :index)
  1
  iex>Elixir.Chinese.year({78, 18, 7, false, 24}, :name)
  "Year"
  iex>Elixir.Chinese.year({78, 18, 7, false, 24}, :value)
  18