Skip to content

Commit f62a735

Browse files
committed
Fix: ISO string dates shouldn't be considered dates
1 parent c253ee9 commit f62a735

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/introspection/getTypeFromValues.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const isString = (value) => typeof value === 'string';
2020
const valuesAreString = (values) => values.every(isString);
2121
const isArray = (value) => Array.isArray(value);
2222
const valuesAreArray = (values) => values.every(isArray);
23-
const isDate = (value) => value instanceof Date || isISODateString(value);
23+
const isDate = (value) => value instanceof Date;
2424
const valuesAreDate = (values) => values.every(isDate);
2525
const isObject = (value) =>
2626
Object.prototype.toString.call(value) === '[object Object]';

src/introspection/getTypeFromValues.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ test('returns DateType for Dates', () =>
6060
expect(
6161
getTypeFromValues('foo', [new Date('2017-03-15'), new Date()])
6262
).toEqual(DateType));
63-
test('returns DateType for Dates as ISO Strings', () =>
63+
test('returns GraphQLString for Dates as ISO Strings', () =>
6464
expect(
6565
getTypeFromValues('foo', [
6666
'2022-01-01T00:00:00.000Z',
6767
'2022-12-01T12:34:56.000Z',
6868
])
69-
).toEqual(DateType));
69+
).toEqual(GraphQLString));
7070

7171
test('returns GraphQLJSON for objects', () =>
7272
expect(

0 commit comments

Comments
 (0)