CalendarLib.DateSourceDate implementation.
include Date_sig.SThe different fields of a date.
Type of a date, without specifying any precision level.
Days of the week.
Months of the year.
Year as an int.
Raised when a date is outside the Julian period.
Raised when a date belongs to [October 5th, 1582; October 14th, 1582].
make year month day makes the date year-month-day. A BC year y corresponds to the year -(y+1). @example years (5 BC) and (1 BC) respectively correspond to years (-4) and 0.
Labelled version of make. The default value of month and day is 1.
make_year y makes a date only represented by its year y. The month and the day of such a date are not relevant.
make_year_month y m makes a date only represented by its year y and its month m. The day of such a date is not relevant.
Make a date from its Julian day. @example from_jd 0 returns the date 4713 BC-1-1.
Make a date from its modified Julian day (i.e. Julian day - 2 400 001). The Modified Julian day is more manageable than the Julian day. @example from_mjd 0 returns the date 1858-11-17.
Make a date from a year and its day of the year. @example from_day_of_year 2008 39 returns the date 2008-2-8.
Number of days in the month of a date. @example days_in_month (make 2003 6 26) returns 30.
Day of the month. @example day_of_month (make 2003 6 26) returns 26.
Day of the year. @example day_of_year (make 2003 1 5) returns 5 @example day_of_year (make 2003 12 28) returns 362.
Week. @example week (make 2000 1 3) returns 1. @example week (make 2000 1 2) returns 52. @example week (make 2003 12 28) returns 52. @example week (make 2003 12 29) returns 1.
Modified Julian day (i.e. Julian day - 2 400 001). The Modified Julian day is more manageable than the Julian day. @example to_mjd (make 1858 11 17) returns 0.
Check if the first date is earlier or equal to the second
Check if a date is valid, that is the date has not been coerced to look like a real date. @example is_valid_date 2008 2 8 returns true @example is_valid_date 2008 2 30 returns false
Return true if a date is a leap day (i.e. February, 24th of a leap year); false otherwise.
Return true if a date belongs to the Gregorian calendar; false otherwise.
Return true iff a date belongs to the Julian calendar; false otherwise.
Convert a date into the Unix.tm type. The field is_isdst is always false. The fields Unix.tm_sec, Unix.tm_min and Unix.tm_hour are irrelevant.
Convert a date to a float such than to_unixfloat (make 1970 1 1) returns 0.0. So such a float is convertible with those of the Unix module. The fractional part of the result is always 0.
Inverse of to_unixfloat. Ignore the fractional part of the argument. Assume the current time zone.
Return the "business week" and the day in this week respecting ISO 8601. Notice that business weeks at the beginning and end of the year can sometimes have year numbers which don't match the real year. @example to_business (make 2000 1 3) returns 2000, 1, Mon @example to_business (make 2000 1 2) returns 1999, 52, Sun @example to_business (make 2003 12 28) returns 2003, 52, Sun @example to_business (make 2003 12 29) returns 2004, 1, Mon.
Inverse of to_business respecting ISO-8601. Notice that business weeks at the beginning and end of the year can sometimes have year numbers which don't match the real year.
Convert a day to an integer respecting ISO-8601. So, Monday is 1, Tuesday is 2, ..., and sunday is 7.
Convert a month to an integer respecting ISO-8601. So, January is 1, February is 2 and so on.
add d p returns d + p.
sub d1 d2 returns the period between d1 and d2.
precise_sub d1 d2 returns the period between d1 and d2. It is equivalent to sub, but:
rem d p is equivalent to add d (Period.opp p).
next d f returns the date corresponding to the next specified field.
prev d f returns the date corresponding to the previous specified field.
Return true if two years have the same calendar; false otherwise.
Number of days in a year.
days_in_year ~month y returns the number of days in the year y up to the end of the given month. Thus days_in_year ~month:Dec y is the same as days_in_year y.
nth_weekday_of_month y m d n returns the n-th day d in the month m of the year y (for instance the 3rd Thursday of the month).
Century of a year. @example century 2000 returns 20 @example century 2001 returns 21.
Millenium of a year. @example millenium 2000 returns 2 @example millenium 2001 returns 3.
Solar number.
In the Julian calendar there is a one-to-one relationship between the Solar number and the day on which a particular date falls.
Indiction.
The Indiction was used in the middle ages to specify the position of a year in a 15 year taxation cycle. It was introduced by emperor Constantine the Great on 1 September 312 and ceased to be used in 1806.
The Indiction has no astronomical significance.
Golden number.
Considering that the relationship between the moon's phases and the days of the year repeats itself every 19 years, it is natural to associate a number between 1 and 19 with each year. This number is the so-called Golden number.
Epact.
The Epact is a measure of the age of the moon (i.e. the number of days that have passed since an "official" new moon) on a particular date.
Easter Sunday.
In the Christian world, Easter (and the days immediately preceding it) is the celebration of the death and resurrection of Jesus in (approximately) AD 30.
Carnaval Monday. carnaval y is easter y - 48.