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

DateTimeFormat overview

This module implements a CVDateTimeFormat, i.e. a CVTemplate (see Template.ts) dedicated to parsing and formatting dates. It supports many of the available Unicode tokens (see https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table).

A CVDateTimeFormat is context-independent: it describes the structure of a date string but carries no locale information. To parse or format a date string, you must combine a CVDateTimeFormat with a CVDateTimeFormatContext by constructing a CVDateTimeParser or a CVDateTimeFormatter.


Table of contents


Constructors

make

Constructs a CVDateTimeFormat from the given CVDateTimeFormatPart’s.

Signature

export declare const make: (...parts: CVDateTimeFormatParts.Type) => Type

Getters

name

Returns the name property of self.

Signature

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

parts

Returns the parts property of self.

Signature

export declare const parts: MTypes.OneArgFunction<Type, CVDateTimeFormatParts.Type>

Instances

basicIso8601

CVDateTimeFormat instance for the basic ISO 8601 date format (YYYYMMDD, e.g. 20050605).

Signature

export declare const basicIso8601: Type

euDate

CVDateTimeFormat instance for the European date format with slashes (DD/MM/YYYY, e.g. 05/06/2005).

Signature

export declare const euDate: Type

euDotDate

CVDateTimeFormat instance for the European date format with dots (DD.MM.YYYY, e.g. 05.06.2005).

Signature

export declare const euDotDate: Type

iso8601

CVDateTimeFormat instance for the ISO 8601 date format (YYYY-MM-DD, e.g. 2005-06-05).

Signature

export declare const iso8601: Type

isoDateTime

CVDateTimeFormat instance for the ISO 8601 date-time format without milliseconds (YYYY-MM- DDTHH:mm:ss, e.g. 2005-06-05T14:05:05).

Signature

export declare const isoDateTime: Type

isoDateTimeMs

CVDateTimeFormat instance for the ISO 8601 date-time format with milliseconds (YYYY-MM- DDTHH:mm:ss.SSS, e.g. 2005-06-05T14:05:05.007).

Signature

export declare const isoDateTimeMs: Type

longDate

CVDateTimeFormat instance for a long date format (MMMM d, yyyy, e.g. June 5, 2005). The month name is locale-dependent and requires an appropriate CVDateTimeFormatContext.

Signature

export declare const longDate: Type

shortDate

CVDateTimeFormat instance for a short date format (MMM d, yyyy, e.g. Jun 5, 2005). The abbreviated month name is locale-dependent and requires an appropriate CVDateTimeFormatContext.

Signature

export declare const shortDate: Type

time12h

CVDateTimeFormat instance for the 12-hour time format without seconds (KK:mm a, e.g. 02:05 PM).

Signature

export declare const time12h: Type

time12hWithSeconds

CVDateTimeFormat instance for the 12-hour time format with seconds (KK:mm:ss a, e.g. 02:05:05 PM).

Signature

export declare const time12hWithSeconds: Type

time24h

CVDateTimeFormat instance for the 24-hour time format without seconds (HH:mm, e.g. 14:05).

Signature

export declare const time24h: Type

time24hWithSeconds

CVDateTimeFormat instance for the 24-hour time format with seconds (HH:mm:ss, e.g. 14:05:05).

Signature

export declare const time24hWithSeconds: Type

usDate

CVDateTimeFormat instance for the US date format (MM/DD/YYYY, e.g. 06/05/2005).

Signature

export declare const usDate: Type

Models

Type (class)

Type that represents a CVDateTimeFormat

Signature

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

make (static method)

Static constructor

Signature

static make(parts: CVDateTimeFormatParts.Type): Type

[MData.idSymbol] (method)

Returns the id of this

Signature

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

name (property)

Name of this CVDateTimeFormat, built by concatenating the string representations of its parts

Signature

readonly name: string

parts (property)

The CVDateTimeFormatPart’s that make up this CVDateTimeFormat

Signature

readonly parts: CVDateTimeFormatParts.Type

Module markers

moduleTag

Module tag

Signature

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