Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support data grid column type date formats #2581

Closed
oliviertassinari opened this issue Aug 30, 2023 · 1 comment · Fixed by #2589
Closed

Support data grid column type date formats #2581

oliviertassinari opened this issue Aug 30, 2023 · 1 comment · Fixed by #2589
Labels
feature: Components Button, input, table, etc. new feature New feature or request waiting for 👍 Waiting for upvotes

Comments

@oliviertassinari
Copy link
Member

oliviertassinari commented Aug 30, 2023

Summary 💡

Today, developers can set their column type to date:

Screenshot 2023-08-30 at 14 14 54

However, have no options to decide what formatting it should use exactly. It's using the default MUI X column type formatting https://mui.com/x/react-data-grid/column-definition/#column-types, so effectively value.toLocaleDateString().

It would be great to be able to choose from more options, a bit like numbers

Screenshot 2023-08-30 at 14 17 19

Examples 🌈

  • Metabase
Screenshot 2023-08-12 at 20 33 03

Motivation 🔦

Less code to write. For now, I will stick to using dayjs: https://github.com/mui/mui-private/blob/c5f0a6288cbbd052cee7f141d2f117bc186ece6a/tools-private/toolpad/resources/invoice.ts#L77

    invoice_date: dayjs(row.invoice_date).format('MMMM D, YYYY'),

It's a continuation of #2371.

@oliviertassinari oliviertassinari added new feature New feature or request waiting for 👍 Waiting for upvotes feature: Components Button, input, table, etc. labels Aug 30, 2023
@Janpot
Copy link
Member

Janpot commented Aug 30, 2023

Taking an initial stab at it in #2589

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: Components Button, input, table, etc. new feature New feature or request waiting for 👍 Waiting for upvotes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants