Constructor
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
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
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
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
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
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
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
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