Show a simple timestamp anywhere in your app!
The Timestamp
component renders a simple string showing a date and time. It is shown in an opinionated format that we believe is well suited for messages.
You can use this as a building block alongside other Cord components to build any message layout that you might need. Any timestamps returned from our APIs can be directly passed in and displayed correctly. For example, timestamps returned from our Message REST API.
import { Timestamp } from "@cord-sdk/react";
export const Example = () => {
// Hour ago from current time
const dateValue = new Date(Date.now() - 1000 * 60 * 60);
return <Timestamp value={dateValue} />;
};
true
, timestamps are shown relative to the current time. When false
, timestamps are shown in absolute terms.true
.If you want to customize this component, you can target the classes below in your app's CSS. These are guaranteed to be stable.
.cord-timestamp
Not finding the answer you need? Ask our Developer Community