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 date/dateTime formatting #2589

Merged
merged 7 commits into from
Sep 13, 2023
Merged

Support date/dateTime formatting #2589

merged 7 commits into from
Sep 13, 2023

Conversation

Janpot
Copy link
Member

@Janpot Janpot commented Aug 30, 2023

This PR proposes date formatting for the date and dateTime columns, in the flavour of the number formatter. Similarly it is built on top of Intl.DateTimeFormat and can be reused for other components just like we reuse the number format for the Metric component

Fixes #2581

Screen.Recording.2023-08-31.at.11.10.21.mov

edit

Reversed the order since the video:

Screenshot 2023-08-31 at 15 15 50

@Janpot Janpot added new feature New feature or request feature: Components Button, input, table, etc. labels Aug 30, 2023
@Janpot Janpot marked this pull request as ready for review August 31, 2023 16:20
]),
);

const DEMO_DATE = new Date();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also be the current time? Anyway not important at all :D

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want a time that always demonstrates whether it's 12h or 24h clock

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a comment

@apedroferreira
Copy link
Member

Just tried it, works great!
Not sure if it would be better for showing time (hours/minutes/seconds) to be an option all under the same column type, but it could depend on what obstacles that would cause or how much each of these types could be expanded.

@Janpot
Copy link
Member Author

Janpot commented Sep 13, 2023

Not sure if it would be better for showing time (hours/minutes/seconds) to be an option all under the same column type, but it could depend on what obstacles that would cause or how much each of these types could be expanded.

You mean only having a dateTime type and not both date and dateTime types? I slightly agree with that, but the X grid has both so it could make sense to follow them for now. Switching to a single column type would be the same as deprecating the date type.

@Janpot Janpot requested a review from a team September 13, 2023 07:38
@apedroferreira
Copy link
Member

Not sure if it would be better for showing time (hours/minutes/seconds) to be an option all under the same column type, but it could depend on what obstacles that would cause or how much each of these types could be expanded.

You mean only having a dateTime type and not both date and dateTime types? I slightly agree with that, but the X grid has both so it could make sense to follow them for now. Switching to a single column type would be the same as deprecating the date type.

Ok, if the X grid separates them I guess we should do the same.

@Janpot Janpot merged commit 01e3cc6 into mui:master Sep 13, 2023
9 checks passed
@Janpot Janpot deleted the date-formatting branch September 13, 2023 15:52
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support data grid column type date formats
2 participants