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

Property Type Description
date Date The wrapped date.
(Inherited from DateValue)
time boolean Whether this value includes a time portion (as opposed to a date only).
(Inherited from DateValue)

Methods

Method Returns Description
dateOnly() DateValue Returns a new obsidian#DateValue with any time portion in this obsidian#DateValue removed.
(Inherited from DateValue)
isTruthy() boolean Returns a boolean indicating whether this obsidian#DateValue is truthy.
(Inherited from DateValue)
parseFromString(input) DateValue | null Create new DateValue from an input string.
(Inherited from DateValue)
printDate() string Formats the date portion of this value as a string.
(Inherited from DateValue)
printTime() string Formats the time portion of this value as a string.
(Inherited from DateValue)
relative() string Returns a new RelativeDateValue based on this obsidian#DateValue.
(Inherited from DateValue)
toString() string String representation of this obsidian#DateValue.
(Inherited from DateValue)

Links to this page: