Skip to main content

core.getdateproperty

Home > @medplum/core > getDateProperty

getDateProperty() function

Returns a Date property as a Date. When working with JSON objects, Dates are often serialized as ISO-8601 strings. When that happens, we need to safely convert to a proper Date object.

Signature:

export declare function getDateProperty(date: string | undefined): Date | undefined;

Parameters

ParameterTypeDescription
datestring | undefinedThe date property value, which could be a string or a Date object.

Returns:

Date | undefined

A Date object.