DateValue
Official
Value wrapping a Date.
Import:
import { DateValue } from 'obsidian';Signature:
export class DateValue extends NotNullValueExtends: NotNullValue
Constructor
new DateValue(date: unknown, showTime?: boolean | undefined)Constructor.
To get the constructor instance, use getDateValueConstructor from obsidian-typings/implementations.
Properties
| Property | Type | Description | |
|---|---|---|---|
| date | Date | The wrapped date. | |
| time | boolean | Whether this value includes a time portion (as opposed to a date only). |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| dateOnly() | DateValue | Returns a new obsidian#DateValue with any time portion in this obsidian#DateValue removed. | |
| isTruthy() | boolean | Returns a boolean indicating whether this obsidian#DateValue is truthy. | |
| parseFromString(input) | DateValue | null | Create new DateValue from an input string. | |
| printDate() | string | Formats the date portion of this value as a string. | |
| printTime() | string | Formats the time portion of this value as a string. | |
| relative() | string | Returns a new RelativeDateValue based on this obsidian#DateValue. | |
| toString() | string | String representation of this obsidian#DateValue. |
Links to this page: