Skip to content

Commit

Permalink
Merge ef02054 into 2625c81
Browse files Browse the repository at this point in the history
  • Loading branch information
jpremmel committed Nov 4, 2021
2 parents 2625c81 + ef02054 commit bd8379e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/GraphQl/Type/TypeConverter.php
Expand Up @@ -76,7 +76,7 @@ public function convertType(Type $type, bool $input, Operation $rootOperation, s

return 'Iterable';
case Type::BUILTIN_TYPE_OBJECT:
if (is_a($type->getClassName(), \DateTimeInterface::class, true)) {
if (is_a($type->getClassName(), \DateTimeInterface::class, true) || is_a($type->getClassName(), \DateInterval::class, true)) {
return GraphQLType::string();
}

Expand Down
1 change: 1 addition & 0 deletions tests/GraphQl/Type/TypeConverterTest.php
Expand Up @@ -90,6 +90,7 @@ public function convertTypeProvider(): array
[new Type(Type::BUILTIN_TYPE_ARRAY), false, 0, 'Iterable'],
[new Type(Type::BUILTIN_TYPE_ITERABLE), false, 0, 'Iterable'],
[new Type(Type::BUILTIN_TYPE_OBJECT, false, \DateTimeInterface::class), false, 0, GraphQLType::string()],
[new Type(Type::BUILTIN_TYPE_OBJECT, false, \DateInterval::class), false, 0, GraphQLType::string()],
[new Type(Type::BUILTIN_TYPE_OBJECT), false, 0, null],
[new Type(Type::BUILTIN_TYPE_CALLABLE), false, 0, null],
[new Type(Type::BUILTIN_TYPE_NULL), false, 0, null],
Expand Down

0 comments on commit bd8379e

Please sign in to comment.