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

Replace DateQueryInput with strings for the dateQuery before and afte… #1239

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/Registry/TypeRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
use WPGraphQL\Type\Enum\TimezoneEnum;
use WPGraphQL\Type\Enum\UserRoleEnum;
use WPGraphQL\Type\Enum\UsersConnectionSearchColumnEnum;
use WPGraphQL\Type\Input\DateInput;
use WPGraphQL\Type\Input\DateQueryInput;
use WPGraphQL\Type\Input\MenuItemsConnectionWhereArgs;
use WPGraphQL\Type\Input\PostObjectsConnectionOrderbyInput;
Expand Down Expand Up @@ -260,7 +259,6 @@ public function init_type_registry( TypeRegistry $type_registry ) {
UsersConnectionOrderbyEnum::register_type();
UsersConnectionSearchColumnEnum::register_type();

DateInput::register_type();
DateQueryInput::register_type();
MenuItemsConnectionWhereArgs::register_type();
PostObjectsConnectionOrderbyInput::register_type();
Expand Down
28 changes: 0 additions & 28 deletions src/Type/Input/DateInput.php

This file was deleted.

8 changes: 4 additions & 4 deletions src/Type/Input/DateQueryInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ public static function register_type() {
'description' => __( 'Second (0 to 59)', 'wp-graphql' ),
],
'after' => [
'type' => 'DateInput',
'description' => __( 'Nodes should be returned after this date', 'wp-graphql' ),
'type' => 'String',
Copy link
Member

Choose a reason for hiding this comment

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

I think we need tighter validation here. I think it would be better to introduce a new DateTime scalar: https://webonyx.github.io/graphql-php/type-system/scalar-types/#writing-custom-scalar-types and use that here instead.

'description' => __( 'Nodes should be returned after this date. An ISO 8601 formatted date, such as "2025-03-29T10:05:45-06:00" is preferred. Alternatively, other English date formats that can be parsed by PHP\'s strtotime() function may be used.', 'wp-graphql' ),
],
'before' => [
'type' => 'DateInput',
'description' => __( 'Nodes should be returned before this date', 'wp-graphql' ),
'type' => 'String',
'description' => __( 'Nodes should be returned before this date. An ISO 8601 formatted date, such as "2025-03-29T10:05:45-06:00" is preferred. Alternatively, other English date formats that can be parsed by PHP\'s strtotime() function may be used.', 'wp-graphql' ),
],
'inclusive' => [
'type' => 'Boolean',
Expand Down