Skip to main content

core.formatdatetime

Home > @medplum/core > formatDateTime

formatDateTime() function

Formats a FHIR dateTime string as a human readable string. Handles missing values and invalid dates.

Signature:

export declare function formatDateTime(dateTime: string | undefined, locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions | undefined): string;

Parameters

Parameter

Type

Description

dateTime

string | undefined

The dateTime to format.

locales

Intl.LocalesArgument

(Optional) Optional locales.

options

Intl.DateTimeFormatOptions | undefined

(Optional) Optional dateTime format options.

Returns:

string

The formatted dateTime string.