Date
add
(
date
,
field
,
amount
)
Adds the specified amount of time to the this instance.
- Parameters:
-
date <Date>
The JavaScript Date object to perform addition on
-
field <String>
The field constant to be used for performing addition.
-
amount <Number>
The number of units (measured in the field constant) to add to the date.
- Returns:
Date
- The resulting Date object
Boolean
after
(
date
,
compareTo
)
Determines whether a given date is after another date on the calendar.
- Parameters:
-
date <Date>
The Date object to compare with the compare argument
-
compareTo <Date>
The Date object to use for the comparison
- Returns:
Boolean
- true if the date occurs after the compared date; false if not.
Boolean
before
(
date
,
compareTo
)
Determines whether a given date is before another date on the calendar.
- Parameters:
-
date <Date>
The Date object to compare with the compare argument
-
compareTo <Date>
The Date object to use for the comparison
- Returns:
Boolean
- true if the date occurs before the compared date; false if not.
Boolean
between
(
date
,
dateBegin
,
dateEnd
)
Determines whether a given date is between two other dates on the calendar.
- Parameters:
-
date <Date>
The date to check for
-
dateBegin <Date>
The start of the range
-
dateEnd <Date>
The end of the range
- Returns:
Boolean
- true if the date occurs between the compared dates; false if not.
Date
clearTime
(
date
)
Clears the time fields from a given date, effectively setting the time to 12 noon.
- Parameters:
-
date <Date>
The JavaScript Date for which the time fields will be cleared
- Returns:
Date
- The JavaScript Date cleared of all time fields
Date
findMonthEnd
(
date
)
Gets the last day of a month containing a given date.
- Parameters:
-
date <Date>
The JavaScript Date used to calculate the month end
- Returns:
Date
- The JavaScript Date representing the last day of the month
Date
findMonthStart
(
date
)
Gets the first day of a month containing a given date.
- Parameters:
-
date <Date>
The JavaScript Date used to calculate the month start
- Returns:
Date
- The JavaScript Date representing the first day of the month
Number
getDayOffset
(
date
,
calendarYear
)
Calculates the number of days the specified date is from January 1 of the specified calendar year.
Passing January 1 to this function would return an offset value of zero.
- Parameters:
-
date <Date>
The JavaScript date for which to find the offset
-
calendarYear <Number>
The calendar year to use for determining the offset
- Returns:
Number
- The number of days since January 1 of the given year
Date
getJan1
(
calendarYear
)
Retrieves a JavaScript Date object representing January 1 of any given year.
- Parameters:
-
calendarYear <Number>
The calendar year for which to retrieve January 1
- Returns:
Date
- January 1 of the calendar year specified.
Number
getWeekNumber
(
date
,
calendarYear
,
weekStartsOn
)
Calculates the week number for the given date. This function assumes that week 1 is the
week in which January 1 appears, regardless of whether the week consists of a full 7 days.
The calendar year can be specified to help find what a the week number would be for a given
date if the date overlaps years. For instance, a week may be considered week 1 of 2005, or
week 53 of 2004. Specifying the optional calendarYear allows one to make this distinction
easily.
- Parameters:
-
date <Date>
The JavaScript date for which to find the week number
-
calendarYear <Number>
OPTIONAL - The calendar year to use for determining the week number. Default is
the calendar year of parameter "date".
-
weekStartsOn <Number>
OPTIONAL - The integer (0-6) representing which day a week begins on. Default is 0 (for Sunday).
- Returns:
Number
- The week number of the given date.
Boolean
isMonthOverlapWeek
(
weekBeginDate
)
Determines if a given week overlaps two different months.
- Parameters:
-
weekBeginDate <Date>
The JavaScript Date representing the first day of the week.
- Returns:
Boolean
- true if the date overlaps two different months.
Boolean
isYearOverlapWeek
(
weekBeginDate
)
Determines if a given week overlaps two different years.
- Parameters:
-
weekBeginDate <Date>
The JavaScript Date representing the first day of the week.
- Returns:
Boolean
- true if the date overlaps two different years.
Date
subtract
(
date
,
field
,
amount
)
Subtracts the specified amount of time from the this instance.
- Parameters:
-
date <Date>
The JavaScript Date object to perform subtraction on
-
field <Number>
The this field constant to be used for performing subtraction.
-
amount <Number>
The number of units (measured in the field constant) to subtract from the date.
- Returns:
Date
- The resulting Date object