Skip to main content

DateTimeClinical

BasicClinical values<co-date-time-clinical>

DateTimeClinical shows dates as MM/DD/YYYY, times in 12- or 24-hour form with an optional zone, and ages from date of birth down to days for newborns, plus gestational age.

import { DateTimeClinical } from 'health-components';

Examples​

Dates And Times​

Storybook

Ages​

Storybook

Obstetrics​

Storybook

Prefix And Relative​

Storybook

Usage​

<DateTimeClinical mode="dob" value="2026-08-28" asOf="2026-10-09" />

When to use​

  • Every date, time, DOB and age on a clinical screen.

When not to use​

  • Date entry: DatePicker.
  • Relative-only times ("5 min ago") with no absolute time.

Variants and states​

VariantWhat it is
date03/14/2026.
time02:05 PM, or 14:05 with hour24.
datetimeDate and time; zone abbreviation when timeZone is set.
dobDOB with age: 03/14/1979 (47 y).
ageAge only: 8 d, 6 wk, 9 mo, 47 y.
gestationalGA 38w 4d from weeks and days or EDD.

Accessibility​

  • Renders a <time> element with an ISO datetime attribute.
  • Age has a title with the long form ("6 weeks").

Do and don't​

  • Do: Pass timeZone for anything across sites or telehealth.
  • Don't: Show a two-digit year.

Props​

PropTypeDefaultDescription
valuestring | Date—Date value: ISO string ('2026-10-09' is a calendar date) or Date; required except in 'gestational' mode
modeDateTimeClinicalMode'date''date' (MM/DD/YYYY) | 'time' | 'datetime' | 'dob' (date and age) | 'age' | 'gestational'
hour24booleanfalse (12-hour)24-hour time
timeZonestringthe browser zoneIANA zone; shows the zone abbreviation with times
asOfstring | DatetodayDate the age or gestational age is computed at
weeksnumbernoneGestational age weeks
daysnumber0Gestational age days
eddstringnoneEstimated due date; gestational age is computed from it when set
prefixstringnoneText before ('Admitted')
relativestringnoneRelative text after ('2 h ago')

Also accepts native attributes, including defaultChecked, defaultValue, autoFocus, plus className and event handlers on the root element.

Angular, Vue and HTML​

Register the elements once (Angular guide), then use <co-date-time-clinical>. Attributes take strings; arrays and objects are set as properties (Angular [prop], Vue :prop) or as JSON attributes. Callbacks are DOM events with the value in event.detail.

Angular template
<co-date-time-clinical mode="…" hour24 [value]="value"></co-date-time-clinical>
KindNameDescription
property / JSON attributevalueDate value: ISO string ('2026-10-09' is a calendar date) or Date; required except in 'gestational' mode
attributemode'date' (MM/DD/YYYY) | 'time' | 'datetime' | 'dob' (date and age) | 'age' | 'gestational'; default 'date'
attributehour2424-hour time; default false (12-hour)
attributetime-zone / timeZoneIANA zone; shows the zone abbreviation with times; default the browser zone
property / JSON attributeas-of / asOfDate the age or gestational age is computed at; default today
attributeweeksGestational age weeks; default none
attributedaysGestational age days; default 0
attributeeddEstimated due date; gestational age is computed from it when set; default none
attributeprefixText before ('Admitted'); default none
attributerelativeRelative text after ('2 h ago'); default none
attributedefault-checked / defaultChecked
property / JSON attributedefault-value / defaultValue
attributeauto-focus / autoFocus