Relative Time
Relative Time composes a time value with formatting and zone-specific views.
Practical React example
Show a time in a selected zone while preserving an unambiguous absolute timestamp.
Before you copy and paste
Use the composed primitives together under their required provider, where one is present. Copy components/kibo-ui/relative-time/index.tsx and its returned support files from the Code tab; preserve the project-relative paths.
Listed package dependencies: @radix-ui/react-use-controllable-state.
Use the Code tab for the component files and installation instructions, then adapt the imports in this example to your project.
Show a time in a selected zone while preserving an unambiguous absolute timestamp
// Usage adapted from Kibo UI's pinned MIT source.
// Copyright (c) 2023 — Present shadcnblocks. See ./LICENSES.md.
"use client";
import {
RelativeTime,
RelativeTimeZone,
RelativeTimeZoneDate,
RelativeTimeZoneDisplay,
RelativeTimeZoneLabel,
} from "@/components/kibo-ui/relative-time";
const timezones = [
{ label: "EST", zone: "America/New_York" },
{ label: "GMT", zone: "Europe/London" },
{ label: "JST", zone: "Asia/Tokyo" },
];
const Example = () => (
<div className="rounded-md border bg-background p-4">
<RelativeTime>
{timezones.map(({ zone, label }) => (
<RelativeTimeZone key={zone} zone={zone}>
<RelativeTimeZoneLabel>{label}</RelativeTimeZoneLabel>
<RelativeTimeZoneDate />
<RelativeTimeZoneDisplay />
</RelativeTimeZone>
))}
</RelativeTime>
</div>
);
export default Example;
Usage example adapted from Kibo UI's pinned MIT source. Retain the source licence notices when copying.
Store a real instant and use a deliberate locale and time zone for display. Keep server and client formatting consistent enough to avoid misleading differences.
Customization
- RelativeTimeProps.time
- Optional; Date.
- RelativeTimeProps.defaultTime
- Optional; Date.
- RelativeTimeProps.onTimeChange
- Optional; (time: Date) => void.
- RelativeTimeProps.dateFormatOptions
- Optional; Intl.DateTimeFormatOptions.
- RelativeTimeProps.timeFormatOptions
- Optional; Intl.DateTimeFormatOptions.
- RelativeTimeZoneProps.zone
- Required; string.
- RelativeTimeZoneProps.dateFormatOptions
- Optional; Intl.DateTimeFormatOptions.
- RelativeTimeZoneProps.timeFormatOptions
- Optional; Intl.DateTimeFormatOptions.
Integration notes
- A relative label such as recently should not be the only timestamp for an important record.
- Test invalid dates and daylight-saving transitions, and expose an absolute time where precision matters.
Component source: Kibo UI documentation . These examples describe the version imported into Rendyn. Upstream APIs may have changed; retain the source licence notices when adapting the code.
Give your agent taste.
The best way to use Rendyn is through MCP. Let your agent find the right component, compare previews and bring the source into your project.
All components are free. Sign up only to connect MCP.