Skip to content

RelativeDateValue

Official

Value wrapping a Date. obsidian#RelativeDateValue behaves the same as a DateValue however it renders as a time relative to now.

Import:

import { RelativeDateValue } from 'obsidian';

Signature:

export class RelativeDateValue extends DateValue

Extends: DateValue

Constructor

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

Constructor.

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

Properties

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

Methods

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

Links to this page: