DurationValue
Official
Value wrapping a duration. Durations can be used to modify a DateValue or can result from subtracting a obsidian#DateValue from another.
Import:
import { DurationValue } from 'obsidian';Signature:
export class DurationValue extends NotNullValueExtends: NotNullValue
Constructor
new DurationValue(years: number, months: number, days: number, hours: number, minutes: number, seconds: number, milliseconds: number)Constructor.
To get the constructor instance, use getDurationValueConstructor from obsidian-typings/implementations.
Properties
| Property | Type | Description | |
|---|---|---|---|
| days | number | The days component of the duration. | |
| hours | number | The hours component of the duration. | |
| milliseconds | number | The milliseconds component of the duration. | |
| minutes | number | The minutes component of the duration. | |
| months | number | The months component of the duration. | |
| seconds | number | The seconds component of the duration. | |
| years | number | The years component of the duration. |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| addToDate(value, subtract?) | DateValue | Modifies the provided DateValue by this duration. | |
| fromMilliseconds(milliseconds) | DurationValue | Create a new DurationValue from milliseconds. | |
| getMilliseconds() | number | Convert this duration into milliseconds. | |
| isTruthy() | boolean | Returns a boolean indicating whether this obsidian#DurationValue is truthy. | |
| parseFromString(input) | DurationValue | null | Create a new DurationValue using an ISO 8601 duration. See https://en.wikipedia.org/wiki/ISO_8601#Durations for duration format details. | |
| toString() | string | String representation of this obsidian#DurationValue. |
Links to this page: