forked from refinedev/refine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* date field doc * boolean doc fix * add link to format prop * add IPost interface for createdAt * interface IPost added and fix table key prop Co-authored-by: Ömer Faruk APLAK <[email protected]>
- Loading branch information
Showing
5 changed files
with
67 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
id: date | ||
title: Date | ||
--- | ||
|
||
import dateField from '@site/static/img/guides-and-concepts/fields/date/dateField.png' | ||
|
||
This field is used to display dates and uses [`Day.js`](https://day.js.org/docs/en/display/format) to display date format. | ||
|
||
## Usage | ||
|
||
Let's see how to use `<DateField>` with the example in the post list. | ||
|
||
```tsx | ||
//highlight-next-line | ||
import { List, Table, DateField } from "@pankod/refine"; | ||
|
||
import { IPost } from "interfaces"; | ||
|
||
export const PostList: React.FC = () => { | ||
|
||
return ( | ||
<List> | ||
<Table rowKey="id"> | ||
//highlight-next-line ... | ||
<Table.Column<IPost> | ||
dataIndex="createdAt" | ||
title="Created At" | ||
key="createdAt" | ||
render={(value) => ( | ||
//highlight-next-line | ||
<DateField format="LLL" value={value} /> | ||
)} | ||
/> | ||
</Table> | ||
</List> | ||
); | ||
}; | ||
``` | ||
|
||
```ts title="interfaces/index.d.ts" | ||
export interface IPost { | ||
id: string; | ||
createdAt: string; | ||
} | ||
``` | ||
|
||
<br/> | ||
<div> | ||
<img src={dateField} alt="DateField Usage"/> | ||
</div> | ||
|
||
## API Reference | ||
|
||
### Properties | ||
|
||
| Property | Description | Type | Default | | ||
| --------------------------------------------------- | ------------------------------------------------------------------- | ----------------------------------------------- | ------- | | ||
| value <div className="required">Required</div> | Date value | `string` \| `number` \| `Date` \| `dayjs.Dayjs` | | | ||
| [format](https://day.js.org/docs/en/display/format) | Get the formatted date according to the string of tokens passed in. | `string` \| `undefined` | `"L"` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+136 KB
documentation/static/img/guides-and-concepts/fields/date/dateField.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.