core.formatdatetime | Medplum

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): string;

Parameters

Parameter Type Description
dateTime string | undefined The dateTime to format.
locales Intl.LocalesArgument (Optional) Optional locales.
options Intl.DateTimeFormatOptions (Optional) Optional dateTime format options.

Returns:

string

The formatted dateTime string.