webgui/www/extras/yui/docs/calendar/YAHOO.widget.DateMath.html
JT Smith 4f68a0933c added YUI and YUI-ext
fixed the resizable text area with IE problem
fixed the ad space with IE problem
merged the 7.2.0 and 7.1.4 change logs
2006-11-07 23:15:57 +00:00

1114 lines
26 KiB
HTML

<html>
<head>
<title>API: Calendar YAHOO.widget.DateMath.html (YUI Library)</title>
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
<h1>Yahoo! UI Library</h1>
<h3><a href="./index.html">Yahoo! UI Library: Calendar</a></h3>
<div class="breadcrumbs">
<a href="./index.html">Yahoo! UI Library: Calendar</a>
&gt;
<strong>YAHOO.widget.DateMath</strong>
</div>
</div>
<div id="body">
<div class="nav">
<div class="module resources">
<ul class="content">
<li><a href="overview-tree.html">Tree View</a></li>
<li><a href="index-all.html">Element Index</a></li>
</ul>
</div>
<div class="module">
<h4><a href="./allclasses-noframe.html">Classes</a></h4>
<ul class="content">
<li>
<a href="YAHOO.widget.html">
YAHOO.widget</a>
</li>
<li>
<a href="YAHOO.widget.Calendar.html">
YAHOO.widget.Calendar</a>
</li>
<li>
<a href="YAHOO.widget.Calendar2up.html">
YAHOO.widget.Calendar2up</a>
</li>
<li>
<a href="YAHOO.widget.Calendar2up_Cal.html">
YAHOO.widget.Calendar2up_Cal</a>
</li>
<li>
<a href="YAHOO.widget.Calendar_Core.html">
YAHOO.widget.Calendar_Core</a>
</li>
<li>
<a href="YAHOO.widget.CalendarGroup.html">
YAHOO.widget.CalendarGroup</a>
</li>
<li>
<a href="YAHOO.widget.DateMath.html">
YAHOO.widget.DateMath</a>
</li>
</ul>
</div>
<div class="module">
<h4><a href="./overview-summary.html">Files</a></h4>
<ul class="content">
<li>
<a href="overview-summary-Calendar.js.html">
Calendar.js</a>
</li>
<li>
<a href="overview-summary-Calendar2up.js.html">
Calendar2up.js</a>
</li>
<li>
<a href="overview-summary-Calendar_Core.js.html">
Calendar_Core.js</a>
</li>
<li>
<a href="overview-summary-CalendarGroup.js.html">
CalendarGroup.js</a>
</li>
<li>
<a href="overview-summary-DateMath.js.html">
DateMath.js</a>
</li>
</ul>
</div>
</div>
<div id="pri">
<div class="main">
<h2>Class YAHOO.widget.DateMath</h2>
<pre>Object
|
+--<b>YAHOO.widget.DateMath</b>
</pre>
<hr />
<!-- Class definition -->
<div class="class-def">
<div class="class-name">
<span class="class-attribs">
</span>
<span class="class-type">class</span>
<b>YAHOO.widget.DateMath</b>
</div>
<div class="class-extends">
</div>
</div>
<div class="meta">
</div>
<!-- ======== QUICK LINKS ======== -->
<div class="quick-links">
<strong>Quick Links:</strong>&nbsp;
<a href="#field_summary">Field Summary</a>
<a href="#methodSummary">Method Summary</a> |
<a href="#methodDetails">Method Details</a>
</div>
<!-- ======== END QUICK LINKS ======== -->
<!-- ======== NESTED CLASS SUMMARY ======== -->
<!-- ======== END NESTED CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<div class="section field summaries">
<h3><a name="field_summary">Field Summary</a> <span class="top">[<a href="#top">top</a>]</span></h3>
<div class="content">
<table border="1" cellpadding="3" cellspacing="0">
<tr>
<td class="flags">String</td>
<td class="spec">
<code>
<a href="#DAY">DAY</a>
</code>
<div class="description">
Constant field representing Day&nbsp;
</div>
</td>
</tr>
<tr>
<td class="flags">String</td>
<td class="spec">
<code>
<a href="#MONTH">MONTH</a>
</code>
<div class="description">
Constant field representing Month&nbsp;
</div>
</td>
</tr>
<tr>
<td class="flags">Integer</td>
<td class="spec">
<code>
<a href="#ONE_DAY_MS">ONE_DAY_MS</a>
</code>
<div class="description">
Constant field representing one day, in milliseconds&nbsp;
</div>
</td>
</tr>
<tr>
<td class="flags">String</td>
<td class="spec">
<code>
<a href="#WEEK">WEEK</a>
</code>
<div class="description">
Constant field representing Week&nbsp;
</div>
</td>
</tr>
<tr>
<td class="flags">String</td>
<td class="spec">
<code>
<a href="#YEAR">YEAR</a>
</code>
<div class="description">
Constant field representing Year&nbsp;
</div>
</td>
</tr>
</table>
</div>
</div>
<!-- =========== END FIELD SUMMARY =========== -->
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<!-- ======== END CONSTRUCTOR SUMMARY ======== -->
<!-- ========== METHOD SUMMARY =========== -->
<div class="section method summaries">
<h3><a name="methodSummary">Method Summary</a> <span class="top">[<a href="#top">top</a>]</span></h3>
<div class="content">
<table border="1" cellpadding="3" cellspacing="0">
<tr>
<td class="flags">Object</td>
<td class="spec">
<code>
<a href="#add">add</a>
(&lt;Date&gt; date, &lt;string&gt; field, &lt;Integer&gt; amount)
</code>
<div class="description">
Adds the specified amount of time to the this instance.&nbsp;
</div>
</td>
</tr>
<tr>
<td class="flags">Boolean</td>
<td class="spec">
<code>
<a href="#after">after</a>
(&lt;Date&gt; date, &lt;Date&gt; compareTo)
</code>
<div class="description">
Determines whether a given date is after another date on the calendar.&nbsp;
</div>
</td>
</tr>
<tr>
<td class="flags">Boolean</td>
<td class="spec">
<code>
<a href="#before">before</a>
(&lt;Date&gt; date, &lt;Date&gt; compareTo)
</code>
<div class="description">
Determines whether a given date is before another date on the calendar.&nbsp;
</div>
</td>
</tr>
<tr>
<td class="flags">Boolean</td>
<td class="spec">
<code>
<a href="#between">between</a>
(&lt;Date&gt; date, &lt;Date&gt; dateBegin, &lt;Date&gt; dateEnd)
</code>
<div class="description">
Determines whether a given date is between two other dates on the calendar.&nbsp;
</div>
</td>
</tr>
<tr>
<td class="flags">Date</td>
<td class="spec">
<code>
<a href="#clearTime">clearTime</a>
(&lt;Date&gt; date)
</code>
<div class="description">
Clears the time fields from a given date, effectively setting the time to midnight.&nbsp;
</div>
</td>
</tr>
<tr>
<td class="flags">Date</td>
<td class="spec">
<code>
<a href="#findMonthEnd">findMonthEnd</a>
(&lt;Date&gt; date)
</code>
<div class="description">
Gets the last day of a month containing a given date.&nbsp;
</div>
</td>
</tr>
<tr>
<td class="flags">Date</td>
<td class="spec">
<code>
<a href="#findMonthStart">findMonthStart</a>
(&lt;Date&gt; date)
</code>
<div class="description">
Gets the first day of a month containing a given date.&nbsp;
</div>
</td>
</tr>
<tr>
<td class="flags">Integer</td>
<td class="spec">
<code>
<a href="#getDayOffset">getDayOffset</a>
(&lt;Date&gt; date, &lt;Integer&gt; calendarYear)
</code>
<div class="description">
Calculates the number of days the specified date is from January 1 of the specified calendar year.&nbsp;
</div>
</td>
</tr>
<tr>
<td class="flags">Date</td>
<td class="spec">
<code>
<a href="#getJan1">getJan1</a>
(&lt;Integer&gt; calendarYear)
</code>
<div class="description">
Retrieves a JavaScript Date object representing January 1 of any given year.&nbsp;
</div>
</td>
</tr>
<tr>
<td class="flags">Integer</td>
<td class="spec">
<code>
<a href="#getWeekNumber">getWeekNumber</a>
(&lt;Date&gt; date, &lt;Integer&gt; calendarYear, &lt;Integer&gt; weekStartsOn)
</code>
<div class="description">
Calculates the week number for the given date.&nbsp;
</div>
</td>
</tr>
<tr>
<td class="flags">Boolean</td>
<td class="spec">
<code>
<a href="#isMonthOverlapWeek">isMonthOverlapWeek</a>
(&lt;Date&gt; weekBeginDate)
</code>
<div class="description">
Determines if a given week overlaps two different months.&nbsp;
</div>
</td>
</tr>
<tr>
<td class="flags">Boolean</td>
<td class="spec">
<code>
<a href="#isYearOverlapWeek">isYearOverlapWeek</a>
(&lt;Date&gt; weekBeginDate)
</code>
<div class="description">
Determines if a given week overlaps two different years.&nbsp;
</div>
</td>
</tr>
<tr>
<td class="flags">Object</td>
<td class="spec">
<code>
<a href="#subtract">subtract</a>
(&lt;Date&gt; date, &lt;Integer&gt; field, &lt;Integer&gt; amount)
</code>
<div class="description">
Subtracts the specified amount of time from the this instance.&nbsp;
</div>
</td>
</tr>
</table>
</div>
</div>
<!-- ========== END METHOD SUMMARY =========== -->
<!-- ============ FIELD DETAIL START =========== -->
<div class="section field details">
<h3><a name="field_detail">Field Detail</a> <span class="top">[<a href="#top">top</a>]</span></h3>
<div class="content">
<h4><a name="DAY">DAY</a></h4>
<div class="detail">
<code>
String
&nbsp;
<strong>DAY</strong>
</code>
<div class="description">
Constant field representing Day
</div>
</div>
<hr />
<h4><a name="MONTH">MONTH</a></h4>
<div class="detail">
<code>
String
&nbsp;
<strong>MONTH</strong>
</code>
<div class="description">
Constant field representing Month
</div>
</div>
<hr />
<h4><a name="ONE_DAY_MS">ONE_DAY_MS</a></h4>
<div class="detail">
<code>
Integer
&nbsp;
<strong>ONE_DAY_MS</strong>
</code>
<div class="description">
Constant field representing one day, in milliseconds
</div>
</div>
<hr />
<h4><a name="WEEK">WEEK</a></h4>
<div class="detail">
<code>
String
&nbsp;
<strong>WEEK</strong>
</code>
<div class="description">
Constant field representing Week
</div>
</div>
<hr />
<h4><a name="YEAR">YEAR</a></h4>
<div class="detail">
<code>
String
&nbsp;
<strong>YEAR</strong>
</code>
<div class="description">
Constant field representing Year
</div>
</div>
<hr />
</div>
</div>
<!-- ============ FIELD DETAIL END =========== -->
<!-- ========= CONSTRUCTOR DETAIL START ======== -->
<div class="section constructor details">
<h3><a name="constructor_detail">Constructor Detail</a> <span class="top">[<a href="#top">top</a>]</span></h3>
<div class="content">
<h4><a name="YAHOO.widget.DateMath()">YAHOO.widget.DateMath</a></h4>
<div class="detail">
<code>
<strong>YAHOO.widget.DateMath</strong>
</code>
<div class="description">
HASH(0x1e2ec80)
</div>
</div>
</div>
</div>
<!-- ========= CONSTRUCTOR DETAIL END ======== -->
<!-- ============ METHOD DETAIL START ========== -->
<div class="section method details">
<h3><a name="methodDetails">Method Detail</a> <span class="top">[<a href="#top">top</a>]</span></h3>
<div class="content">
<h4><a name="add">add</a></h4>
<div class="detail">
<code>
Object
<strong>add</strong>
(&lt;Date&gt; date, &lt;string&gt; field, &lt;Integer&gt; amount)
</code>
<div class="description">
Adds the specified amount of time to the this instance.
<dl>
<dt>Parameters:</dt>
<dd>
<code>date</code> -
The JavaScript Date object to perform addition on
</dd>
<dd>
<code>field</code> -
The this field constant to be used for performing addition.
</dd>
<dd>
<code>amount</code> -
The number of units (measured in the field constant) to add to the date.
</dd>
</dl>
HASH(0x1e40cdc)
</div>
</div>
<hr />
<h4><a name="after">after</a></h4>
<div class="detail">
<code>
Boolean
<strong>after</strong>
(&lt;Date&gt; date, &lt;Date&gt; compareTo)
</code>
<div class="description">
Determines whether a given date is after another date on the calendar.
<dl>
<dt>Parameters:</dt>
<dd>
<code>date</code> -
The Date object to compare with the compare argument
</dd>
<dd>
<code>compareTo</code> -
The Date object to use for the comparison
</dd>
</dl>
<dl>
<dt>Returns:</dt>
<dd> true if the date occurs after the compared date; false if not.</dd>
</dl>
HASH(0x1e40ef8)
</div>
</div>
<hr />
<h4><a name="before">before</a></h4>
<div class="detail">
<code>
Boolean
<strong>before</strong>
(&lt;Date&gt; date, &lt;Date&gt; compareTo)
</code>
<div class="description">
Determines whether a given date is before another date on the calendar.
<dl>
<dt>Parameters:</dt>
<dd>
<code>date</code> -
The Date object to compare with the compare argument
</dd>
<dd>
<code>compareTo</code> -
The Date object to use for the comparison
</dd>
</dl>
<dl>
<dt>Returns:</dt>
<dd> true if the date occurs before the compared date; false if not.</dd>
</dl>
HASH(0x1dd19f0)
</div>
</div>
<hr />
<h4><a name="between">between</a></h4>
<div class="detail">
<code>
Boolean
<strong>between</strong>
(&lt;Date&gt; date, &lt;Date&gt; dateBegin, &lt;Date&gt; dateEnd)
</code>
<div class="description">
Determines whether a given date is between two other dates on the calendar.
<dl>
<dt>Parameters:</dt>
<dd>
<code>date</code> -
The date to check for
</dd>
<dd>
<code>dateBegin</code> -
The start of the range
</dd>
<dd>
<code>dateEnd</code> -
The end of the range
</dd>
</dl>
<dl>
<dt>Returns:</dt>
<dd> true if the date occurs between the compared dates; false if not.</dd>
</dl>
HASH(0x1dd1bd0)
</div>
</div>
<hr />
<h4><a name="clearTime">clearTime</a></h4>
<div class="detail">
<code>
Date
<strong>clearTime</strong>
(&lt;Date&gt; date)
</code>
<div class="description">
Clears the time fields from a given date, effectively setting the time to midnight.
<dl>
<dt>Parameters:</dt>
<dd>
<code>date</code> -
The JavaScript Date for which the time fields will be cleared
</dd>
</dl>
<dl>
<dt>Returns:</dt>
<dd> The JavaScript Date cleared of all time fields</dd>
</dl>
HASH(0x1dd1d98)
</div>
</div>
<hr />
<h4><a name="findMonthEnd">findMonthEnd</a></h4>
<div class="detail">
<code>
Date
<strong>findMonthEnd</strong>
(&lt;Date&gt; date)
</code>
<div class="description">
Gets the last day of a month containing a given date.
<dl>
<dt>Parameters:</dt>
<dd>
<code>date</code> -
The JavaScript Date used to calculate the month end
</dd>
</dl>
<dl>
<dt>Returns:</dt>
<dd> The JavaScript Date representing the last day of the month</dd>
</dl>
HASH(0x1d1db48)
</div>
</div>
<hr />
<h4><a name="findMonthStart">findMonthStart</a></h4>
<div class="detail">
<code>
Date
<strong>findMonthStart</strong>
(&lt;Date&gt; date)
</code>
<div class="description">
Gets the first day of a month containing a given date.
<dl>
<dt>Parameters:</dt>
<dd>
<code>date</code> -
The JavaScript Date used to calculate the month start
</dd>
</dl>
<dl>
<dt>Returns:</dt>
<dd> The JavaScript Date representing the first day of the month</dd>
</dl>
HASH(0x1e405a4)
</div>
</div>
<hr />
<h4><a name="getDayOffset">getDayOffset</a></h4>
<div class="detail">
<code>
Integer
<strong>getDayOffset</strong>
(&lt;Date&gt; date, &lt;Integer&gt; calendarYear)
</code>
<div class="description">
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.
<dl>
<dt>Parameters:</dt>
<dd>
<code>date</code> -
The JavaScript date for which to find the offset
</dd>
<dd>
<code>calendarYear</code> -
The calendar year to use for determining the offset
</dd>
</dl>
<dl>
<dt>Returns:</dt>
<dd> The number of days since January 1 of the given year</dd>
</dl>
HASH(0x1dd2140)
</div>
</div>
<hr />
<h4><a name="getJan1">getJan1</a></h4>
<div class="detail">
<code>
Date
<strong>getJan1</strong>
(&lt;Integer&gt; calendarYear)
</code>
<div class="description">
Retrieves a JavaScript Date object representing January 1 of any given year.
<dl>
<dt>Parameters:</dt>
<dd>
<code>calendarYear</code> -
The calendar year for which to retrieve January 1
</dd>
</dl>
<dl>
<dt>Returns:</dt>
<dd> January 1 of the calendar year specified.</dd>
</dl>
HASH(0x1dd2344)
</div>
</div>
<hr />
<h4><a name="getWeekNumber">getWeekNumber</a></h4>
<div class="detail">
<code>
Integer
<strong>getWeekNumber</strong>
(&lt;Date&gt; date, &lt;Integer&gt; calendarYear, &lt;Integer&gt; weekStartsOn)
</code>
<div class="description">
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.
<dl>
<dt>Parameters:</dt>
<dd>
<code>date</code> -
The JavaScript date for which to find the week number
</dd>
<dd>
<code>calendarYear</code> -
OPTIONAL - The calendar year to use for determining the week number. Default is the calendar year of parameter "date".
</dd>
<dd>
<code>weekStartsOn</code> -
OPTIONAL - The integer (0-6) representing which day a week begins on. Default is 0 (for Sunday).
</dd>
</dl>
<dl>
<dt>Returns:</dt>
<dd> The week number of the given date.</dd>
</dl>
HASH(0x1dd24ac)
</div>
</div>
<hr />
<h4><a name="isMonthOverlapWeek">isMonthOverlapWeek</a></h4>
<div class="detail">
<code>
Boolean
<strong>isMonthOverlapWeek</strong>
(&lt;Date&gt; weekBeginDate)
</code>
<div class="description">
Determines if a given week overlaps two different months.
<dl>
<dt>Parameters:</dt>
<dd>
<code>weekBeginDate</code> -
The JavaScript Date representing the first day of the week.
</dd>
</dl>
<dl>
<dt>Returns:</dt>
<dd> true if the date overlaps two different months.</dd>
</dl>
HASH(0x1dd2734)
</div>
</div>
<hr />
<h4><a name="isYearOverlapWeek">isYearOverlapWeek</a></h4>
<div class="detail">
<code>
Boolean
<strong>isYearOverlapWeek</strong>
(&lt;Date&gt; weekBeginDate)
</code>
<div class="description">
Determines if a given week overlaps two different years.
<dl>
<dt>Parameters:</dt>
<dd>
<code>weekBeginDate</code> -
The JavaScript Date representing the first day of the week.
</dd>
</dl>
<dl>
<dt>Returns:</dt>
<dd> true if the date overlaps two different years.</dd>
</dl>
HASH(0x1dd27f4)
</div>
</div>
<hr />
<h4><a name="subtract">subtract</a></h4>
<div class="detail">
<code>
Object
<strong>subtract</strong>
(&lt;Date&gt; date, &lt;Integer&gt; field, &lt;Integer&gt; amount)
</code>
<div class="description">
Subtracts the specified amount of time from the this instance.
<dl>
<dt>Parameters:</dt>
<dd>
<code>date</code> -
The JavaScript Date object to perform subtraction on
</dd>
<dd>
<code>field</code> -
The this field constant to be used for performing subtraction.
</dd>
<dd>
<code>amount</code> -
The number of units (measured in the field constant) to subtract from the date.
</dd>
</dl>
HASH(0x1de00ec)
</div>
</div>
<hr />
</div>
</div>
<!-- ============ METHOD DETAIL END ========== -->
</div>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<div id="footer">
<hr />
Copyright &copy; 2006 Yahoo! Inc. All rights reserved.
<br /><br />
Documentation generated by <a href="http://jsdoc.sourceforge.net/">
JSDoc</a>
</div>
</body>
</html>