-
Notifications
You must be signed in to change notification settings - Fork 4.5k
DataViews: Add date
field type
#70657
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
DataViews: Add date
field type
#70657
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
- Added 'date' as a new field type in the types definition. - Updated SpaceObject to include 'datetime' alongside 'date' in the fixtures. - Created a new date field type implementation with sorting and validation functions. - Updated field type definitions to include the new 'date' type. - Added a new story for rendering date fields in the component library.
4927289
to
23e7870
Compare
@@ -95,6 +100,7 @@ export const data: SpaceObject[] = [ | |||
categories: [ 'Space', 'Planet', 'Solar system' ], | |||
satellites: 0, | |||
date: '2020-01-02T01:00:00Z', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a couple of date
props that have datetime
data. Not a big issue, and the value is actually displayed as date. To avoid confusion in the future, I'd rather use date-only values for the date prop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the interest of velocity, I'm going to push these changes and merge the PR after the tests pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, it's a PR from a fork, and I don't have permissions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in 4b739ac.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good first step, thanks. Are you following up with filters/edit soon?
Yes, it's on my list. I'll create a PR soon! 🙌 |
Co-authored-by: chihsuan <chihsuan@git.wordpress.org> Co-authored-by: oandregal <oandregal@git.wordpress.org>
Co-authored-by: chihsuan <chihsuan@git.wordpress.org> Co-authored-by: oandregal <oandregal@git.wordpress.org>
What?
Related to Automattic/wp-calypso#104438
Added a new date field type in the dataviews package with sorting and validation functions, but have not yet implemented the edit component.
Changes:
SpaceObject
to include 'datetime' alongside 'date' in the fixtures.Why?
Date is a very common data type in various use cases. We already have a datetime field type, but for some use cases, we only need to display/edit the data without the time. Additionally, we want to be able to filter by date using the new Calendar component. To support this, we need to add a new date field type first.
How?
To make it easier for review, this PR only adds the new date field type but not yet implemented the edit component.
I'll create a follow-up PR (https://github.com/chihsuan/gutenberg/compare/add/dateviews-date-field-type...chihsuan:gutenberg:add/dataviews-date-control?expand=1) to implement the
edit
component for the new date field type.Testing Instructions
npm run storybook:dev
Testing Instructions for Keyboard
Screenshots or screencast
Date

Datetime
