Skip to content

MomentFormatComponent

Official

A component that allows you to format dates using Moment.js.

Import:

import { MomentFormatComponent } from 'obsidian';

Signature:

export class MomentFormatComponent extends TextComponent

Extends: TextComponent

Constructor

new MomentFormatComponent(containerEl: HTMLElement)

Constructor.

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

Properties

Property Type Description
sampleEl HTMLElement The HTML element that represents the sample value.

Methods

Method Returns Description
autoSelect(force?) this Selects the input's text when it receives focus.
(Inherited from TextComponent)
onChanged() void Called when the value of the component changes.
setDefaultFormat(defaultFormat) this Sets the default format when input is cleared. Also used for placeholder.
setSampleEl(sampleEl) this Sets the sample HTML element.
setValue(value) this Sets the value of the component.
updateSample() void Updates the sample value.

Links to this page: