new DiscworldCalendar(languageopt)
Implementation of the Discworld calendar - Unseen University version.
See also http://wiki.lspace.org/mediawiki/Discworld_calendar
and http://discworld.wikia.com/wiki/Discworld_calendar.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
language |
string |
<optional> |
'' | The language code (default English) for localisation. |
- Source:
Members
(static) daysPerMonth
Days per month in a common year.
- Source:
(static) firstMonth
The first month in the year.
- Source:
(static) hasYearZero
true
if has a year zero, false
if not.
- Source:
(static) jdEpoch
Julian date of start of Discworld epoch: 1 January 0001 CE.
- Source:
(static) minDay
The minimum day number.
- Source:
(static) minMonth
The minimum month number.
- Source:
(static) name
The calendar name.
- Source:
(static) regionalOptions
Localisations for the plugin.
Entries are objects indexed by the language code ('' being the default US/English).
Each object has the following attributes.
Properties:
Name | Type | Description |
---|---|---|
name |
string | The calendar name. |
epochs |
Array.<string> | The epoch names (before/after year 0). |
monthNames |
Array.<string> | The long names of the months of the year. |
monthNamesShort |
Array.<string> | The short names of the months of the year. |
dayNames |
Array.<string> | The long names of the days of the week. |
dayNamesShort |
Array.<string> | The short names of the days of the week. |
dayNamesMin |
Array.<string> | The minimal names of the days of the week. |
dateFormat |
string | The date format for this calendar.
See the options on formatDate for details. |
firstDay |
number | The number of the first day of the week, starting at 0. |
isRTL |
boolean | true if this localisation reads right-to-left. |
- Source:
Methods
(static) dayOfWeek(year, monthopt, dayopt) → {number}
Retrieve the day of the week for a date.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
year |
CDate | number | The date to examine or the year to examine. | |
month |
number |
<optional> |
The month to examine (if only year specified above). |
day |
number |
<optional> |
The day to examine (if only year specified above). |
- Source:
Throws:
Error if an invalid date or a different calendar used.
Returns:
The day of the week: 0 to number of days - 1.
- Type
- number
(static) daysInMonth(year, monthopt) → {number}
Retrieve the number of days in a month.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
year |
CDate | number | The date to examine or the year of the month. | |
month |
number |
<optional> |
The month (if only year specified above). |
- Source:
Throws:
Error if an invalid month/year or a different calendar used.
Returns:
The number of days in this month.
- Type
- number
(static) daysInWeek() → {number}
Retrieve the number of days in a week.
- Source:
Returns:
The number of days.
- Type
- number
(static) daysInYear(year) → {number}
Retrieve the number of days in a year.
Parameters:
Name | Type | Description |
---|---|---|
year |
CDate | number | The date to examine or the year to examine. |
- Source:
Throws:
Error if an invalid year or a different calendar used.
Returns:
The number of days.
- Type
- number
(static) extraInfo(year, monthopt, dayopt) → {object}
Retrieve additional information about a date.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
year |
CDate | number | The date to examine or the year to examine. | |
month |
number |
<optional> |
The month to examine (if only year specified above). |
day |
number |
<optional> |
The day to examine (if only year specified above). |
- Source:
Throws:
Error if an invalid date or a different calendar used.
Returns:
Additional information - contents depends on calendar.
- Type
- object
(static) fromJD(jd) → {CDate}
Create a new date from a Julian date.
Parameters:
Name | Type | Description |
---|---|---|
jd |
number | The Julian date to convert. |
- Source:
Returns:
The equivalent date.
- Type
- CDate
(static) leapYear(year) → {boolean}
Determine whether this date is in a leap year.
Parameters:
Name | Type | Description |
---|---|---|
year |
CDate | number | The date to examine or the year to examine. |
- Source:
Throws:
Error if an invalid year or a different calendar used.
Returns:
true
if this is a leap year, false
if not.
- Type
- boolean
(static) monthsInYear(year) → {number}
Retrieve the number of months in a year.
Parameters:
Name | Type | Description |
---|---|---|
year |
CDate | number | The date to examine or the year to examine. |
- Source:
Throws:
Error if an invalid year or a different calendar used.
Returns:
The number of months.
- Type
- number
(static) toJD(year, monthopt, dayopt) → {number}
Retrieve the Julian date equivalent for this date,
i.e. days since January 1, 4713 BCE Greenwich noon.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
year |
CDate | number | The date to convert or the year to convert. | |
month |
number |
<optional> |
The month to convert (if only year specified above). |
day |
number |
<optional> |
The day to convert (if only year specified above). |
- Source:
Throws:
Error if an invalid date or a different calendar used.
Returns:
The equivalent Julian date.
- Type
- number
(static) weekDay(year, monthopt, dayopt) → {boolean}
Determine whether this date is a week day.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
year |
CDate | number | The date to examine or the year to examine. | |
month |
number |
<optional> |
The month to examine (if only year specified above). |
day |
number |
<optional> |
The day to examine (if only year specified above). |
- Source:
Throws:
Error if an invalid date or a different calendar used.
Returns:
true
if a week day, false
if not.
- Type
- boolean
(static) weekOfYear(year, monthopt, dayopt) → {number}
Determine the week of the year for a date.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
year |
CDate | number | The date to examine or the year to examine. | |
month |
number |
<optional> |
The month to examine (if only year specified above). |
day |
number |
<optional> |
The day to examine (if only year specified above). |
- Source:
Throws:
Error if an invalid date or a different calendar used.
Returns:
The week of the year.
- Type
- number