ts-time-format/OffsetDateTimeFormatter

Consumption

import OffsetDateTimeFormatter, {OffsetDateTimeCompiler, OFFSET_DATE_TIME_COMPILERS} from "ts-time-format/OffsetDateTimeFormatter";

Default export#

Hierarchy#

Description#

Formatter of OffsetDateTime to a string. You may initialize a formatter explicitly by using of method, or implicitly by using ofPattern method. See OFFSET_DATE_TIME_COMPILERS for supported pattern characters. See parsePattern for general pattern writing guidelines.

Methods#

format (inherited from TemporalFormatter)#

(value: OffsetDateTime, context?: any): string

value
Value to format.
context
Context object (see TemporalCompiler).
returns
Formatted string.
Formats value to a string as concatenation of write method call results on all components.

Static methods#

of#

(components: TemporalFormatComponent<OffsetDateTime>[]): OffsetDateTimeFormatter

components
Ordered array of format components.
returns
Formatter.
Constructs a formatter explicitly by components.
ofPattern#

(pattern: string, compilers: Dictionary<OffsetDateTimeCompiler> = OFFSET_DATE_TIME_COMPILERS): OffsetDateTimeFormatter

pattern
Pattern string.
compilers
Dictionary from supported pattern characters to the respective compilers.
returns
Formatter.
Constructs a formatter implicitly by pattern. See parsePattern for details.

OffsetDateTimeCompiler#

Hierarchy#

Description#

TemporalCompiler for OffsetDateTime.

Fields#

maxLength (inherited from TemporalCompiler)#

readonly maxLength: number

Maximum number of sequential characters supported in a pattern.

Methods#

compile (inherited from TemporalCompiler)#

(value: OffsetDateTime, length: number, context: any = DEFAULT_TEMPORAL_CONTEXT): string

value
Value to compile.
length
Number of sequential characters used in a pattern.
context
Context object.
returns
Compiled string.
Compiles value to a string based on number of sequential characters specified in length and compiler-dependent context object which can be used, in particular, to specify language-specific textual strings.

OFFSET_DATE_TIME_COMPILERS#

OFFSET_DATE_TIME_COMPILERS: Dictionary<OffsetDateTimeCompiler>

Default dictionary from pattern character to the respective compiler. Union of interface-compatible adapters around DATE_COMPILERS, TIME_COMPILERS and OFFSET_COMPILERS.