Skip to main content Link Search Menu Expand Document (external link)

DateTimeFormatter overview

This module implements a CVDateTimeFormatter, i.e. an object that can convert a CVDateTime into a string according to the passed CVDateTimeFormat and CVDateTimeFormatContext.


Table of contents


Constructors

make

Builds a CVDateTimeFormatter from a CVDateTimeFormat and a CVDateTimeFormatContext.

Signature

export declare const make: typeof Type.make

Getters

format

Returns the format property of self.

Signature

export declare const format: MTypes.OneArgFunction<
  Type,
  MTypes.OneArgFunction<CVDateTime.Type, Result.Result<string, MInputError.Type>>
>

formatOrThrow

Returns the formatOrThrow property of self.

Signature

export declare const formatOrThrow: MTypes.OneArgFunction<Type, MTypes.OneArgFunction<CVDateTime.Type, string>>

name

Returns the name property of self.

Signature

export declare const name: MTypes.OneArgFunction<Type, string>

Models

Type (class)

Type that represents a CVDateTimeFormatter

Signature

export declare class Type {
  private constructor({ name, format, formatOrThrow }: MTypes.Data<Type>)
}

make (static method)

Static constructor

Signature

static make({
    dateTimeFormat,
    context,
  }: {
    readonly dateTimeFormat: CVDateTimeFormat.Type;
    readonly context: CVDateTimeFormatContext.Type;
  }): Type

[MData.idSymbol] (method)

Returns the id of this

Signature

[MData.idSymbol](): string | (() => string)

name (property)

Name of this CVDateTimeFormatter

Signature

readonly name: string

format (property)

Function that tries to format a CVDateTime into a string

Signature

readonly format: MTypes.OneArgFunction<CVDateTime.Type, Result.Result<string, MInputError.Type>>

formatOrThrow (property)

Same as format but throws instead of returning a Failure in case of failure.

Signature

readonly formatOrThrow: MTypes.OneArgFunction<CVDateTime.Type, string>

Module markers

moduleTag

Module tag

Signature

export declare const moduleTag: "@parischap/conversions/formatting/DateTimeFormat/DateTimeFormatter/"