Duration
Inspired by Rails' ActiveSupport::Duration. Provides accurate date and time measurements.
Example:
// Retuns a Date with the timestamp for a month before the current date and time.
(1).month.ago
Test:
Static Member Summary
Static Public Members | ||
public static get |
|
|
public static get |
|
|
public static get |
|
|
public static get |
|
|
public static get |
|
|
public static get |
|
Constructor Summary
Public Constructor | ||
public |
constructor(seconds: Number): Duration |
Member Summary
Public Members | ||
public get |
|
|
public get |
|
|
public get |
asMilliseconds: Number: * |
|
public get |
|
|
public get |
|
|
public get |
|
|
public get |
|
|
public |
|
Method Summary
Public Methods | ||
public |
Alias of since |
|
public |
A Date in the past of the given Date, or new Date() if not supplied |
|
public |
Alias of ago |
|
public |
Alias of since |
|
public |
A Date in the future of the given Date, or new Date() if not supplied |
|
public |
Alias of ago |
|
public |
|
Static Public Members
public static get SECONDS_PER_MONTH: Number: * source
Return:
Number | the number of seconds in a month. Note: for this purpose, a month is presumed to be 1/12th of a year. |
Public Constructors
Public Methods
public after(date: Date): Date source
Alias of since
Params:
Name | Type | Attribute | Description |
date | Date |
|
public ago(date: Date): Date source
A Date in the past of the given Date, or new Date() if not supplied
Params:
Name | Type | Attribute | Description |
date | Date |
|
public before(date: Date): Date source
Alias of ago
Params:
Name | Type | Attribute | Description |
date | Date |
|
public fromNow(date: Date): Date source
Alias of since
Params:
Name | Type | Attribute | Description |
date | Date |
|
public since(date: Date): Date source
A Date in the future of the given Date, or new Date() if not supplied
Params:
Name | Type | Attribute | Description |
date | Date |
|
public until(date: Date): Date source
Alias of ago
Params:
Name | Type | Attribute | Description |
date | Date |
|