|
|
|
add(
date
: Date
interval
: String
amount
: int
) :
void
Add to a Date in intervals of different size, from milliseconds to years
Parameter |
Type |
Usage |
Description |
date |
Date |
required |
Date object to start with |
interval |
String |
required |
|
amount |
int |
required |
How much to add to the date. |
|
|
|
|
compare(
date1
: Date
date2
: Date
portion
: String
) :
void
Compare two date objects by date, time, or both.
Returns 0 if equal, positive if a > b, else negative.
Parameter |
Type |
Usage |
Description |
date1 |
Date |
required |
object |
date2 |
Date |
optional |
object. If not specified, the current Date is used. |
portion |
String |
optional |
A string indicating the "date" or "time" portion of a Date object. |
|
|
|
|
difference(
date1
: Date
date2
: Date
interval
: String
) :
void
Get the difference in a specific unit of time (e.g., number of
months, weeks, days, etc.) between two dates, rounded to the
nearest integer.
Parameter |
Type |
Usage |
Description |
date1 |
Date |
required |
object |
date2 |
Date |
optional |
object. If not specified, the current Date is used. |
interval |
String |
optional |
|
|
|
|
|
getDaysInMonth(
dateObject
: Date
) :
void
Returns the number of days in the month used by dateObject
Parameter |
Type |
Usage |
Description |
dateObject |
Date |
required |
|
|
|
|
|
getTimezoneName(
dateObject
: Date
) :
void
Get the user's time zone as provided by the browser
Try to get time zone info from toString or toLocaleString method of
the Date object -- UTC offset is not a time zone. See
Parameter |
Type |
Usage |
Description |
dateObject |
Date |
required |
Needed because the timezone may vary with time (daylight savings) |
|
|
|
|
isLeapYear(
dateObject
: Date
) :
void
Determines if the year of the dateObject is a leap year
Leap years are years with an additional day YYYY-02-29, where the
Parameter |
Type |
Usage |
Description |
dateObject |
Date |
required |
|
|