Calixir v0.1.7 Calixir.SampleDates View Source

The main purpose of this module is to provide test data for functions written in Elixir or Erlang to convert dates from one calendar into the corresponding dates in another calendar.

This module provides the following calendrica-4.0 dates as Elixir data:

Sample Dates: they contain 33 dates from various years in seven files (see DR4, pp. 447 - 453):

dates1.csv, dates2.csv, dates3.csv, dates4.csv, dates3.csv, dates6.csv, dates7.csv

Both the year dates and the sample dates cover the same calendars. Thus they can be combined into a single large data table that contains 33 rows from the dates*.csv files and 365/366 rows per year from the 201*.csv files.

One cell or entry of this table contains the date of one calendar on a specific day.

Date Structures

There are a couple of nested data structures you need to understand in order to use the functions. From smallest to largest:

calendar

This is an atom, that represents the name of a calendar.

date

This is a number or a tuple. A date expresses a single date of some calendar. It is only useful if combined with a calendar.

caldate

This is a tuple, beginning with a calendar, followed by a date of that calendar:

caldate = {:calendar, {:calendar_field1, :calendar_field2, ...}}, i.e. caldate = {:gregorian, {2010, 1, 1}}

caldate_row

This is a list of caldates of a specific day across all the calendars discussed in DR4.

[caldate_1, caldate_2, caldate_3, ...], i.e. [{:fixed, 2345678}, {:gregorian, {2010, 1, 1}}, ...]

caldate_table

This is the table of all caldate_rows. It is the largest data structure that contains all the others.

NOTE: All data in the caldate_table are static.

The examples given only work with these data. They don't perfom date calculations or date conversions!

The sample data have been precaculated by the functions of the original Lisp program calendrica-4.0.cl and provided in the files mentioned above.

Link to this section Summary

Functions

Returns the caldate structure of calendar in the caldate_row.

Returns a list of the date structures used in calendrica-4.0.

Returns the complete list of caldates.

Returns all the calendar dates at fixed datefixed.

Returns all the calendar dates at Gregorian date{year, month, day}.

Returns all the calendar dates at Julian Day Number jd.

Returns all caldates of calendar.

Returns the calendar part of the calendar date structurte caldate.

Returns a list of pairs (= tuples) with a calendar date of calendar1 and the corresponding calendar date of calendar2.

Returns a list of the calendars used in calendrica-4.0 in the order in which they appear in the sample files.

Outputs a list of the calendars used in calendrica-4.0 in the alphabetic order.

Returns the date of the caldate of calendar in the caldate_row.

Returns the date part of the calendar date structure caldate.

Returns all the dates of calendar.

Returns a list of pairs (= tuples) with a calendar date of a fixed date (aka Rata Die or R.D. of DR4) and the equivalent calendar date of calendar. Per default, the function returns the first 33 entries of the data table. These 33 rows are the data used in the Sample Data of DR4 445ff.

Returns a list of pairs (= tuples) with a calendar date of the Julian Day Number and the equivalent calendar date of calendar.

Link to this section Functions

Link to this function

caldate_in_row(calendar, caldate_row)

View Source

Returns the caldate structure of calendar in the caldate_row.

Returns a list of the date structures used in calendrica-4.0.

Each date_struct is a list, beginning with a calendar and followed by one or more fields defining a date of that calendar. In other words: The date_struct defines a caldate:

date_struct: {:gregorian, {:gregorian_year, :gregorian_month, :gregorian_day}} caldate: {:gregorian, {2010, 1, 1}}

date_struct: {:fixed, :fixed} caldate: {:fixed, 2345678}

The date structs are derived from the two header lines (calendars and fields) of the files containing the year dates and the sample dates.

Returns the complete list of caldates.

Link to this function

caldates_at_fixed(fixed)

View Source

Returns all the calendar dates at fixed datefixed.

Link to this function

caldates_at_gregorian(year, month, day)

View Source

Returns all the calendar dates at Gregorian date{year, month, day}.

Returns all the calendar dates at Julian Day Number jd.

Link to this function

caldates_of_calendar(calendar)

View Source

Returns all caldates of calendar.

Link to this function

calendar_of_caldate(caldate)

View Source

Returns the calendar part of the calendar date structurte caldate.

Link to this function

calendar_to_calendar(calendar1, calendar2)

View Source

Returns a list of pairs (= tuples) with a calendar date of calendar1 and the corresponding calendar date of calendar2.

Used to create date pairs for testing date-to-date conversions, i.e.:

calendar_to_calendar(:fixed, :gregorian) calendar_to_calendar(:gregorian, :hebrew)

Returns a list of the calendars used in calendrica-4.0 in the order in which they appear in the sample files.

NOTE: Not all results provided by this function are calendars proper. Some are just sub-structures (like chinese_day_name) or repeating data (like weekday), or astro data (like solstice).

The calendars are derived from the first two header lines of the files containing the year dates and the sample dates.

Outputs a list of the calendars used in calendrica-4.0 in the alphabetic order.

akan_name
arithmetic_french
arithmetic_persian
armenian
astro_bahai
astro_hindu_lunar
astro_hindu_solar
astronomical_easter
aztec_tonalpohualli
aztec_xihuitl
babylonian
bahai
bali_pawukon
chinese
chinese_day_name
coptic
dawn
easter
egyptian
ephem_corr
eqn_of_time
ethiopic
fixed
french
gregorian
hebrew
hindu_lunar
hindu_solar
icelandic
islamic
iso
jd
julian
lunar_alt
lunar_lat
lunar_long
mayan_haab
mayan_long_count
mayan_tzolkin
midday
mjd
moonrise
moonset
new_moon_after
next_zhongqi
observational_hebrew
observational_islamic
old_hindu_lunar
old_hindu_solar
olympiad
orthodox_easter
persian
roman
samaritan
saudi_islamic
set
solar_long
solstice
tibetan
unix
weekday
Link to this function

date_in_row(calendar, caldate_row)

View Source

Returns the date of the caldate of calendar in the caldate_row.

Link to this function

date_of_caldate(caldate)

View Source

Returns the date part of the calendar date structure caldate.

Single-value dates are returned as atoms. Multi-value dates are returned as tuples.

Link to this function

dates_of_calendar(calendar)

View Source

Returns all the dates of calendar.

Returns a list of pairs (= tuples) with a calendar date of a fixed date (aka Rata Die or R.D. of DR4) and the equivalent calendar date of calendar. Per default, the function returns the first 33 entries of the data table. These 33 rows are the data used in the Sample Data of DR4 445ff.

This is a convenience function.

Returns a list of pairs (= tuples) with a calendar date of the Julian Day Number and the equivalent calendar date of calendar.

This is a convenience function.