TX Text Control .NET Server

Javascript: DateFormField.getSupportedDateFormats Method

Method|Introduced in 28.0

Description

Gets an array of format picture strings which can be used to format the date. The returned format strings depend on the culture set for the date field's text. A TextControl uses Day, Month, Year, and Era Format Picture strings to format a date.

Syntax

<void> DateFormField.getSupportedDateFormats(<RequestStringsCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Receives the supported format strings.

errorCallback

Optional. Is called when the operation failed with an error.

Examples

The following example demonstrates DateFormField.getSupportedDateFormats in a practical document-editing workflow. It gets an array of format picture strings which can be used to format the date. The returned format strings depend on the culture set for the date field's text. A TextControl uses Day, Month, Year, and Era Format Picture strings to format a date.

function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

function inspectSupportedDateFormats(dateFormField) {
    dateFormField.getSupportedDateFormats(
        function(result) {
            console.log("get supported date formats result:", result);
        },
        onTxError
    );
}