Skip to main content
Version: 2.xx.xx

Date

This field is used to display dates. It uses Day.js to display date format.

Usage

Let's see how we can use <DateField> with the example in the post list.

import { 
List,
Table,
DateField
} from "@pankod/refine";

export const PostList: React.FC = () => {

return (
<List>
<Table rowKey="id">
...
<Table.Column<IPost>
dataIndex="createdAt"
title="Created At"
render={(value) => (
<DateField format="LLL" value={value} />
)}
/>
...
</Table>
</List>
);
};

interface IPost {
id: string;
createdAt: string;
}

DateField

API Reference

Properties

PropertyDescriptionTypeDefault
value
Required
Date valuestring | number | Date | dayjs.Dayjs
formatGets the formatted date according to the string of the tokens passed in.string | undefined"L"

Refer to Text props