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

PropertyTypeDescription
sampleElHTMLElementThe HTML element that represents the sample value.

Methods

MethodReturnsDescription
autoSelect(force?)thisSelects the input's text when it receives focus.
(Inherited from TextComponent)
onChanged()voidCalled when the value of the component changes.
setDefaultFormat(defaultFormat)thisSets the default format when input is cleared. Also used for placeholder.
setSampleEl(sampleEl)thisSets the sample HTML element.
setValue(value)thisSets the value of the component.
updateSample()voidUpdates the sample value.

Links to this page: