ts-time-format/ZonedDateTimeFormatter

Consumption

import ZonedDateTimeFormatter, {ZonedDateTimeCompiler, ZONED_DATE_TIME_COMPILERS, ZONE_ID_COMPILER} from "ts-time-format/ZonedDateTimeFormatter";

Default export#

Hierarchy#

Description#

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

Methods#

format (inherited from TemporalFormatter)#

(value: ZonedDateTime, 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<ZonedDateTime>[]): ZonedDateTimeFormatter

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

(pattern: string, compilers: Dictionary<ZonedDateTimeCompiler> = ZONED_DATE_TIME_COMPILERS): ZonedDateTimeFormatter

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.

ZonedDateTimeCompiler#

Hierarchy#

Description#

TemporalCompiler for ZonedDateTime.

Fields#

maxLength (inherited from TemporalCompiler)#

readonly maxLength: number

Maximum number of sequential characters supported in a pattern.

Methods#

compile (inherited from TemporalCompiler)#

(value: ZonedDateTime, 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.

ZONED_DATE_TIME_COMPILERS#

ZONED_DATE_TIME_COMPILERS: Dictionary<ZonedDateTimeCompiler>

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

ZONE_ID_COMPILER#

ZONE_ID_COMPILER: ZonedDateTimeCompiler

Writes zonedDateTime.zone. Only length of 1 is supported.

Default pattern character is "V".