Class Index | File Index

Classes


Class YAHOO.widget.DateMath

YAHOO.widget.DateMath is used for simple date manipulation. The class is a static utility used for adding, subtracting, and comparing dates.


Defined in: calendar.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Field Summary
Field Attributes Field Name and Description
<static>  
YAHOO.widget.DateMath.DAY
Constant field representing Day
<static>  
YAHOO.widget.DateMath.MONTH
Constant field representing Month
<static>  
YAHOO.widget.DateMath.ONE_DAY_MS
Constant field representing one day, in milliseconds
<static>  
YAHOO.widget.DateMath.WEEK
Constant field representing Week
<static>  
YAHOO.widget.DateMath.YEAR
Constant field representing Year
Method Summary
Method Attributes Method Name and Description
<static>  
YAHOO.widget.DateMath.add(date, field, amount)
Adds the specified amount of time to the this instance.
<static>  
YAHOO.widget.DateMath.after(date, compareTo)
Determines whether a given date is after another date on the calendar.
<static>  
YAHOO.widget.DateMath.before(date, compareTo)
Determines whether a given date is before another date on the calendar.
<static>  
YAHOO.widget.DateMath.between(date, dateBegin, dateEnd)
Determines whether a given date is between two other dates on the calendar.
<static>  
YAHOO.widget.DateMath.clearTime(date)
Clears the time fields from a given date, effectively setting the time to midnight.
<static>  
YAHOO.widget.DateMath.findMonthEnd(date)
Gets the last day of a month containing a given date.
<static>  
YAHOO.widget.DateMath.findMonthStart(date)
Gets the first day of a month containing a given date.
<static>  
YAHOO.widget.DateMath.getDayOffset(date, calendarYear)
Calculates the number of days the specified date is from January 1 of the specified calendar year.
<static>  
YAHOO.widget.DateMath.getJan1(calendarYear)
Retrieves a JavaScript Date object representing January 1 of any given year.
<static>  
YAHOO.widget.DateMath.getWeekNumber(date, calendarYear, weekStartsOn)
Calculates the week number for the given date.
<static>  
YAHOO.widget.DateMath.isMonthOverlapWeek(weekBeginDate)
Determines if a given week overlaps two different months.
<static>  
YAHOO.widget.DateMath.isYearOverlapWeek(weekBeginDate)
Determines if a given week overlaps two different years.
<static>  
YAHOO.widget.DateMath.subtract(date, field, amount)
Subtracts the specified amount of time from the this instance.
Class Detail
YAHOO.widget.DateMath()
Field Detail
<static> {String} YAHOO.widget.DateMath.DAY
Constant field representing Day

<static> {String} YAHOO.widget.DateMath.MONTH
Constant field representing Month

<static> {Integer} YAHOO.widget.DateMath.ONE_DAY_MS
Constant field representing one day, in milliseconds

<static> {String} YAHOO.widget.DateMath.WEEK
Constant field representing Week

<static> {String} YAHOO.widget.DateMath.YEAR
Constant field representing Year
Method Detail
<static> YAHOO.widget.DateMath.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
{string} field
The this field constant to be used for performing addition.
{Integer} amount
The number of units (measured in the field constant) to add to the date.

<static> {Boolean} YAHOO.widget.DateMath.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
{Date} compareTo
The Date object to use for the comparison
Returns:
{Boolean} true if the date occurs after the compared date; false if not.

<static> {Boolean} YAHOO.widget.DateMath.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
{Date} compareTo
The Date object to use for the comparison
Returns:
{Boolean} true if the date occurs before the compared date; false if not.

<static> {Boolean} YAHOO.widget.DateMath.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
{Date} dateBegin
The start of the range
{Date} dateEnd
The end of the range
Returns:
{Boolean} true if the date occurs between the compared dates; false if not.

<static> {Date} YAHOO.widget.DateMath.clearTime(date)
Clears the time fields from a given date, effectively setting the time to midnight.
Parameters:
{Date} date
The JavaScript Date for which the time fields will be cleared
Returns:
{Date} The JavaScript Date cleared of all time fields

<static> {Date} YAHOO.widget.DateMath.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

<static> {Date} YAHOO.widget.DateMath.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

<static> {Integer} YAHOO.widget.DateMath.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
{Integer} calendarYear
The calendar year to use for determining the offset
Returns:
{Integer} The number of days since January 1 of the given year

<static> {Date} YAHOO.widget.DateMath.getJan1(calendarYear)
Retrieves a JavaScript Date object representing January 1 of any given year.
Parameters:
{Integer} calendarYear
The calendar year for which to retrieve January 1
Returns:
{Date} January 1 of the calendar year specified.

<static> {Integer} YAHOO.widget.DateMath.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
{Integer} calendarYear
OPTIONAL - The calendar year to use for determining the week number. Default is the calendar year of parameter "date".
{Integer} weekStartsOn
OPTIONAL - The integer (0-6) representing which day a week begins on. Default is 0 (for Sunday).
Returns:
{Integer} The week number of the given date.

<static> {Boolean} YAHOO.widget.DateMath.isMonthOverlapWeek(weekBeginDate)
Determines if a given week overlaps two different months.
Parameters:
{Date} weekBeginDate
The JavaScript Date representing the first day of the week.
Returns:
{Boolean} true if the date overlaps two different months.

<static> {Boolean} YAHOO.widget.DateMath.isYearOverlapWeek(weekBeginDate)
Determines if a given week overlaps two different years.
Parameters:
{Date} weekBeginDate
The JavaScript Date representing the first day of the week.
Returns:
{Boolean} true if the date overlaps two different years.

<static> YAHOO.widget.DateMath.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
{Integer} field
The this field constant to be used for performing subtraction.
{Integer} amount
The number of units (measured in the field constant) to subtract from the date.

Documentation generated by JsDoc Toolkit 2.0.0 on Thu Dec 02 2010 15:18:59 GMT+0100 (CET)