ObservationDetail.DateTime
A date and time display component with flexible formatting options and fallback content support. Designed for healthcare observation timestamps with localization and conditional rendering capabilities.
Basic Example
import { ObservationDetail } from "@ovok/native";
import * as React from "react";
const BasicTimestamp = () => (
<ObservationDetail.DateTime dateTime="2024-01-15T10:30:00Z" />
);
export default BasicTimestamp;
Props
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
dateTime | string | - | - | ISO date string to format and display |
format | string | - | "dd MMMM yyyy, EEEE HH:mm" | Date format pattern |
style | StyleProp<TextStyle> | - | - | Custom text styles |
children | React.ReactNode | - | - | Fallback content when no dateTime |
Inherits all props from react-native-paper Text except children
Component Behavior
Date Formatting
- Uses
date-fnsfor reliable date formatting - Supports all date-fns format patterns
- Handles invalid dates gracefully
- Provides localized date display
Conditional Rendering
- Shows formatted date when
dateTimeis provided - Renders
childrencontent whendateTimeis undefined - Returns null if no
dateTimeand nochildren