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

ParameterTypeDescription
dateTimestring | undefinedThe dateTime to format.
localesIntl.LocalesArgument(Optional) Optional locales.
optionsIntl.DateTimeFormatOptions | undefined(Optional) Optional dateTime format options.

Returns:

string

The formatted dateTime string.