/** * @file * * Mock of Obsidian's `RelativeDateValue`, a Bases date value rendered relative to now. */ import type { RelativeDateValue as RelativeDateValueOriginal } from 'obsidian'; import type { RenderContext } from './RenderContext.mjs'; import { DateValue } from './DateValue.mjs'; /** * Mock of Obsidian's `RelativeDateValue`, which behaves like a `DateValue` but renders as a time relative to now. */ export declare class RelativeDateValue extends DateValue { /** * Creates a value wrapping `date`. * * @param date - The date to wrap. * @param showTime - Whether the time portion is shown. */ constructor(date: Date, showTime?: boolean); /** * Mock-only factory: creates a relative date value, spyable via `vi.spyOn(RelativeDateValue, 'create2__')`. * It is the subclass variant of `DateValue`'s factory. * * @param date - The date to wrap. * @param showTime - Whether the time portion is shown. * @returns The new relative date value. */ static create2__(date: Date, showTime?: boolean): RelativeDateValue; /** * Mock-only: views a value typed as Obsidian's `RelativeDateValue` as this mock. * * @param value - The value typed as the original `RelativeDateValue`. * @returns The same object, typed as the mock. */ static fromOriginalType4__(value: RelativeDateValueOriginal): RelativeDateValue; /** * Mock-only: views this mock as Obsidian's `RelativeDateValue` type. * * @returns The same object, typed as the original `RelativeDateValue`. */ asOriginalType4__(): RelativeDateValueOriginal; /** * Mock-only construction hook, called at the end of the constructor; a no-op meant for * `vi.spyOn(RelativeDateValue.prototype, 'constructor4__')`. * * @param _date - The date the value was created with. * @param _showTime - Whether the time portion was requested. */ constructor4__(_date: unknown, _showTime?: boolean): void; /** * Renders the value into an element, as Obsidian does: a span holding the relative text, in place of the * disabled date input {@link DateValue.renderTo} builds. * * The span still carries the `mod-datetime` / `mod-date` class its base's input would, chosen by the same * `time` flag, so a stylesheet keyed off that class reaches both forms. * * @param el - The element to render into. * @param _context - The rendering context; unused. */ renderTo(el: HTMLElement, _context: RenderContext): void; /** * Formats the value relative to now, as Obsidian does for this subclass. * * @returns Moment's `fromNow` text, such as `3 days ago`, in place of `DateValue`'s absolute form. */ toString(): string; }