Constructor
class
new Duration(secondsopt, nanosecondsopt)
Create a Duration.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
seconds |
number | string |
<optional> |
0 | The second part of the duration. |
nanoseconds |
number | string |
<optional> |
0 | The nanosecond part of the duration. |
- Source:
Methods
function
eq(other) → {boolean}
Determine whether two Duration objects are equal.
Parameters:
| Name | Type | Description |
|---|---|---|
other |
Duration | The Duration object to be compared. |
- Source:
Returns:
Return true if they are equal.
Type
boolean
function
get:nanoseconds() → {number|string}
Get the nanosecond part of the Duration.
- Source:
Returns:
- value in nanosecond, if the value is greater than Number.MAX_SAFE_INTEGER (2^53-1), will be presented in string of decimal format.
Type
number
|
string
function
gt(other) → {boolean}
Determine whether the Duration object is greater than another one.
Parameters:
| Name | Type | Description |
|---|---|---|
other |
Duration | The Duration object to be compared. |
- Source:
Returns:
Return true if it's greater than other.
Type
boolean
function
gte(other) → {boolean}
Determine whether the Duration object is greater than or equal with another one.
Parameters:
| Name | Type | Description |
|---|---|---|
other |
Duration | The Duration object to be compared. |
- Source:
Returns:
Return true if it's greater than or equal with other.
Type
boolean
function
lt(other) → {boolean}
Determine whether the Duration object is less than another one.
Parameters:
| Name | Type | Description |
|---|---|---|
other |
Duration | The Duration object to be compared. |
- Source:
Returns:
Return true if it's less than other.
Type
boolean
function
lte(other) → {boolean}
Determine whether the Duration object is less than or equal with another one.
Parameters:
| Name | Type | Description |
|---|---|---|
other |
Duration | The Duration object to be compared. |
- Source:
Returns:
Return true if it's less than or equal with other.
Type
boolean
function
ne(other) → {boolean}
Determine whether two Duration objects are not equal.
Parameters:
| Name | Type | Description |
|---|---|---|
other |
Duration | The Duration object to be compared. |
- Source:
Returns:
Return true if they are not equal.
Type
boolean