Class YAHOO.widget.DateMath

Object
   |
   +--YAHOO.widget.DateMath

class YAHOO.widget.DateMath

Field Summary [top]

String DAY
Constant field representing Day 
String MONTH
Constant field representing Month 
Integer ONE_DAY_MS
Constant field representing one day, in milliseconds 
String WEEK
Constant field representing Week 
String YEAR
Constant field representing Year 

Method Summary [top]

Object add (<Date> date, <string> field, <Integer> amount)
Adds the specified amount of time to the this instance. 
Boolean after (<Date> date, <Date> compareTo)
Determines whether a given date is after another date on the calendar. 
Boolean before (<Date> date, <Date> compareTo)
Determines whether a given date is before another date on the calendar. 
Boolean between (<Date> date, <Date> dateBegin, <Date> dateEnd)
Determines whether a given date is between two other dates on the calendar. 
Date clearTime (<Date> date)
Clears the time fields from a given date, effectively setting the time to midnight. 
Date findMonthEnd (<Date> date)
Gets the last day of a month containing a given date. 
Date findMonthStart (<Date> date)
Gets the first day of a month containing a given date. 
Integer getDayOffset (<Date> date, <Integer> calendarYear)
Calculates the number of days the specified date is from January 1 of the specified calendar year. 
Date getJan1 (<Integer> calendarYear)
Retrieves a JavaScript Date object representing January 1 of any given year. 
Integer getWeekNumber (<Date> date, <Integer> calendarYear, <Integer> weekStartsOn)
Calculates the week number for the given date. 
Boolean isMonthOverlapWeek (<Date> weekBeginDate)
Determines if a given week overlaps two different months. 
Boolean isYearOverlapWeek (<Date> weekBeginDate)
Determines if a given week overlaps two different years. 
Object subtract (<Date> date, <Integer> field, <Integer> amount)
Subtracts the specified amount of time from the this instance. 

Field Detail [top]

DAY

String   DAY
Constant field representing Day

MONTH

String   MONTH
Constant field representing Month

ONE_DAY_MS

Integer   ONE_DAY_MS
Constant field representing one day, in milliseconds

WEEK

String   WEEK
Constant field representing Week

YEAR

String   YEAR
Constant field representing Year

Constructor Detail [top]

YAHOO.widget.DateMath

YAHOO.widget.DateMath
HASH(0x1dd78a4)

Method Detail [top]

add

Object add (<Date> date, <string> field, <Integer> amount)
Adds the specified amount of time to the this instance.
Parameters:
date - The JavaScript Date object to perform addition on
field - The this field constant to be used for performing addition.
amount - The number of units (measured in the field constant) to add to the date.
HASH(0x1daf17c)

after

Boolean after (<Date> date, <Date> compareTo)
Determines whether a given date is after another date on the calendar.
Parameters:
date - The Date object to compare with the compare argument
compareTo - The Date object to use for the comparison
Returns:
true if the date occurs after the compared date; false if not.
HASH(0x1daf398)

before

Boolean before (<Date> date, <Date> compareTo)
Determines whether a given date is before another date on the calendar.
Parameters:
date - The Date object to compare with the compare argument
compareTo - The Date object to use for the comparison
Returns:
true if the date occurs before the compared date; false if not.
HASH(0x1db5f50)

between

Boolean between (<Date> date, <Date> dateBegin, <Date> dateEnd)
Determines whether a given date is between two other dates on the calendar.
Parameters:
date - The date to check for
dateBegin - The start of the range
dateEnd - The end of the range
Returns:
true if the date occurs between the compared dates; false if not.
HASH(0x1db6130)

clearTime

Date clearTime (<Date> date)
Clears the time fields from a given date, effectively setting the time to midnight.
Parameters:
date - The JavaScript Date for which the time fields will be cleared
Returns:
The JavaScript Date cleared of all time fields
HASH(0x1db62f8)

findMonthEnd

Date findMonthEnd (<Date> date)
Gets the last day of a month containing a given date.
Parameters:
date - The JavaScript Date used to calculate the month end
Returns:
The JavaScript Date representing the last day of the month
HASH(0x1cfe98c)

findMonthStart

Date findMonthStart (<Date> date)
Gets the first day of a month containing a given date.
Parameters:
date - The JavaScript Date used to calculate the month start
Returns:
The JavaScript Date representing the first day of the month
HASH(0x1daea38)

getDayOffset

Integer getDayOffset (<Date> date, <Integer> 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 - The JavaScript date for which to find the offset
calendarYear - The calendar year to use for determining the offset
Returns:
The number of days since January 1 of the given year
HASH(0x1db66a0)

getJan1

Date getJan1 (<Integer> calendarYear)
Retrieves a JavaScript Date object representing January 1 of any given year.
Parameters:
calendarYear - The calendar year for which to retrieve January 1
Returns:
January 1 of the calendar year specified.
HASH(0x1db68a4)

getWeekNumber

Integer getWeekNumber (<Date> date, <Integer> calendarYear, <Integer> 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 - The JavaScript date for which to find the week number
calendarYear - OPTIONAL - The calendar year to use for determining the week number. Default is the calendar year of parameter "date".
weekStartsOn - OPTIONAL - The integer (0-6) representing which day a week begins on. Default is 0 (for Sunday).
Returns:
The week number of the given date.
HASH(0x1db6a0c)

isMonthOverlapWeek

Boolean isMonthOverlapWeek (<Date> weekBeginDate)
Determines if a given week overlaps two different months.
Parameters:
weekBeginDate - The JavaScript Date representing the first day of the week.
Returns:
true if the date overlaps two different months.
HASH(0x1db6c94)

isYearOverlapWeek

Boolean isYearOverlapWeek (<Date> weekBeginDate)
Determines if a given week overlaps two different years.
Parameters:
weekBeginDate - The JavaScript Date representing the first day of the week.
Returns:
true if the date overlaps two different years.
HASH(0x1db6d54)

subtract

Object subtract (<Date> date, <Integer> field, <Integer> amount)
Subtracts the specified amount of time from the this instance.
Parameters:
date - The JavaScript Date object to perform subtraction on
field - The this field constant to be used for performing subtraction.
amount - The number of units (measured in the field constant) to subtract from the date.
HASH(0x1dc80bc)