Skip to content

DateValue

Official

Value wrapping a Date.

Import:

import { DateValue } from 'obsidian';

Signature:

export class DateValue extends NotNullValue

Extends: NotNullValue

Constructor

new DateValue(date: unknown, showTime?: boolean | undefined)

Constructor.

To get the constructor instance, use getDateValueConstructor from obsidian-typings/implementations.

Properties

PropertyTypeDescription
dateDateThe wrapped date.
timebooleanWhether this value includes a time portion (as opposed to a date only).

Methods

MethodReturnsDescription
dateOnly()DateValueReturns a new obsidian#DateValue with any time portion in this obsidian#DateValue removed.
isTruthy()booleanReturns a boolean indicating whether this obsidian#DateValue is truthy.
parseFromString(input)DateValue | nullCreate new DateValue from an input string.
printDate()stringFormats the date portion of this value as a string.
printTime()stringFormats the time portion of this value as a string.
relative()stringReturns a new RelativeDateValue based on this obsidian#DateValue.
toString()stringString representation of this obsidian#DateValue.

Links to this page: