Class: GregorianCalendar

GregorianCalendar

new GregorianCalendar(languageopt)

Parameters:
Name Type Attributes Default Description
language string <optional>
'' The language code (default English) for localisation.
Source:

Extends

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 Gregorian 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 Attributes Default Description
name string <optional>
'Gregorian' The calendar name.
epochs Array.<string> <optional>
['BCE','CE'] The epoch names.
monthNames Array.<string> <optional>
[...] The long names of the months of the year.
monthNamesShort Array.<string> <optional>
[...] The short names of the months of the year.
dayNames Array.<string> <optional>
[...] The long names of the days of the week.
dayNamesShort Array.<string> <optional>
[...] The short names of the days of the week.
dayNamesMin Array.<string> <optional>
[...] The minimal names of the days of the week.
digits CalendarsDigits <optional>
null Convert numbers to localised versions.
dateFormat string <optional>
'mm/dd/yyyy' The date format for this calendar. See the options on formatDate for details.
firstDay number <optional>
0 The number of the first day of the week, starting at 0.
isRTL boolean <optional>
false true if this localisation reads right-to-left.
Source:

Methods

(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 numeric year specified above).
Source:
Throws:
Error if an invalid month/year or a different calendar is used.
Returns:
The number of days in this month.
Type
number

(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) fromJSDate(jsd) → {CDate}

Create a new date from a standard (Gregorian) JavaScript Date.
Parameters:
Name Type Description
jsd Date The JavaScript 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 is used.
Returns:
true if this is a leap year, false if not.
Type
boolean

(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 numeric year specified above).
day number <optional>
The day to convert (if numeric year specified above).
Source:
Throws:
Error if an invalid date or a different calendar is used.
Returns:
The equivalent Julian date.
Type
number

(static) toJSDate(year, monthopt, dayopt) → {Date}

Convert this date to a standard (Gregorian) JavaScript Date.
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 numeric year specified above).
day number <optional>
The day to convert (if numeric year specified above).
Source:
Throws:
Error if an invalid date or a different calendar is used.
Returns:
The equivalent JavaScript date.
Type
Date

(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 numeric year specified above).
day number <optional>
The day to examine (if numeric year specified above).
Source:
Throws:
Error if an invalid date or a different calendar is 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 - ISO 8601.
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 numeric year specified above).
day number <optional>
The day to examine (if numeric year specified above).
Source:
Throws:
Error if an invalid date or a different calendar is used.
Returns:
The week of the year, starting from 1.
Type
number