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

DateTimeParser overview

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


Table of contents


Constructors

make

Builds a CVDateTimeParser from a CVDateTimeFormat and a CVDateTimeFormatContext.

Signature

export declare const make: (params: {
  readonly dateTimeFormat: CVDateTimeFormat.Type
  readonly context: CVDateTimeFormatContext.Type
}) => Type

Getters

name

Returns the name property of self.

Signature

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

parse

Returns the parse property of self.

Signature

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

parseOrThrow

Returns the parseOrThrow property of self.

Signature

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

Models

Type (class)

Type that represents a CVDateTimeParser

Signature

export declare class Type {
  private constructor({ name, parse, parseOrThrow }: 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 CVDateTimeParser

Signature

readonly name: string

parse (property)

Function that tries to parse a string into a CVDateTime

Signature

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

parseOrThrow (property)

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

Signature

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

Module markers

moduleTag

Module tag

Signature

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