Skip to content

Time

A component for displaying a date and time in a human readable format, either relative to the current time or absolute.

See all the examples and details in the Storybook.

Usage

tsx
import { Time } from "@samgl/graffiti-ui";

const MyTime = () => {
  return <Time date={new Date(Date.now() - 1000 * 60 * 15)} />;
};

Props

PropTypeDefaultOptionalDescription
dateDateThe date to display.
relativebooleanfalseIf true the time will be displayed relative to the current time.
classNamestringThe class name of the component, generally used when extending the component with a styled component.