mirror of
https://github.com/strapi/strapi.git
synced 2025-11-12 16:22:10 +00:00
Update doc
Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
parent
5b5bd67e07
commit
faa1873003
@ -74,15 +74,15 @@ To be able to see the update, you will need to have a Content Type that have a `
|
|||||||
|
|
||||||
Then you will have to investigate into the [`strapi-plugin-content-manager`](https://github.com/strapi/strapi/tree/master/packages/strapi-plugin-content-manager) package to find the file that is used to format the date for the list view.
|
Then you will have to investigate into the [`strapi-plugin-content-manager`](https://github.com/strapi/strapi/tree/master/packages/strapi-plugin-content-manager) package to find the file that is used to format the date for the list view.
|
||||||
|
|
||||||
Here is the [Row component](https://github.com/strapi/strapi/blob/master/packages/strapi-plugin-content-manager/admin/src/components/CustomTable/Row.js) you will have to update.
|
Here is the [Row component](https://github.com/strapi/strapi/blob/master/packages/strapi-plugin-content-manager/admin/src/components/CustomTable/Row.js) which requires a [dedicated file](https://github.com/strapi/strapi/blob/master/packages/strapi-plugin-content-manager/admin/src/utils/dateFormats.js) to modify the date display.
|
||||||
|
|
||||||
### Eject the file
|
### Eject the file
|
||||||
|
|
||||||
Let's eject the file to be able to customize it.
|
Let's eject the file to be able to customize it.
|
||||||
|
|
||||||
**Path —** `./extensions/content-manager/admin/src/components/CustomTable/Row.js`
|
**Path —** `./extensions/content-manager/admin/src/utils/dateFormats.js`
|
||||||
|
|
||||||
In this new file, paste the current [Row component](https://github.com/strapi/strapi/blob/master/packages/strapi-plugin-content-manager/admin/src/components/CustomTable/Row.js) code.
|
In this new file, paste the current [dateFormats](https://github.com/strapi/strapi/blob/master/packages/strapi-plugin-content-manager/admin/src/utils/dateFormats.js) code.
|
||||||
|
|
||||||
To run your application, you will have to run the `yarn develop --watch-admin` command.
|
To run your application, you will have to run the `yarn develop --watch-admin` command.
|
||||||
|
|
||||||
@ -95,13 +95,17 @@ In our example, we want to change the format of the date. We have to find in thi
|
|||||||
Here is the code you have to find:
|
Here is the code you have to find:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
return moment
|
const dateFormats = {
|
||||||
.parseZone(date)
|
...defaultDateFormats,
|
||||||
.utc()
|
// Customise the format by uncommenting the one you wan to override it corresponds to the type of your field
|
||||||
.format('dddd, MMMM Do YYYY');
|
// date: 'dddd, MMMM Do YYYY',
|
||||||
|
// datetime: 'dddd, MMMM Do YYYY HH:mm',
|
||||||
|
// time: 'HH:mm A',
|
||||||
|
// timestamp: 'dddd, MMMM Do YYYY HH:mm',
|
||||||
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
Now let's replace `.format('dddd, MMMM Do YYYY');` by `.format('YYYY/MM/DD');`
|
Now let's replace `data: 'dddd, MMMM Do YYYY'` by `date: 'YYYY/MM/DD';`
|
||||||
|
|
||||||
And tada, the date will now display with the new format.
|
And tada, the date will now display with the new format.
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,8 @@
|
|||||||
// Here's the file: strapi/docs/3.0.0-beta.x/admin-panel/customization.md#tutorial-videos
|
// Here's the file: strapi/docs/3.0.0-beta.x/admin-panel/customization.md#tutorial-videos
|
||||||
// IF THE DOC IS NOT UPDATED THE PULL REQUEST WILL NOT BE MERGED
|
// IF THE DOC IS NOT UPDATED THE PULL REQUEST WILL NOT BE MERGED
|
||||||
|
|
||||||
|
// IMPORTANT: It also needs to be added to the migration guide.
|
||||||
|
|
||||||
export const LOGIN_LOGO = null;
|
export const LOGIN_LOGO = null;
|
||||||
export const SHOW_TUTORIALS = true;
|
export const SHOW_TUTORIALS = true;
|
||||||
export const SETTINGS_BASE_URL = '/settings';
|
export const SETTINGS_BASE_URL = '/settings';
|
||||||
|
|||||||
@ -1,3 +1,9 @@
|
|||||||
|
// NOTE TO PLUGINS DEVELOPERS:
|
||||||
|
// If you modify this file you need to update the documentation accordingly
|
||||||
|
// Here's the file: strapi/docs/3.0.0-beta.x/guides/custom-admin.md#update-the-content-manager
|
||||||
|
// Also the strapi-generate-plugins/files/admin/src/index.js needs to be updated
|
||||||
|
// IF THE DOC IS NOT UPDATED THE PULL REQUEST WILL NOT BE MERGED
|
||||||
|
|
||||||
import { dateFormats as defaultDateFormats } from 'strapi-helper-plugin';
|
import { dateFormats as defaultDateFormats } from 'strapi-helper-plugin';
|
||||||
|
|
||||||
const dateFormats = {
|
const dateFormats = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user