Skip to content

Commit

Permalink
Do not parse numbers as dates
Browse files Browse the repository at this point in the history
A number with four or eight digits was treated as a date if it matched one of the following date formats: YYYY, YYYYMMDD or YYYYMMDD
  • Loading branch information
johnwalley committed Jan 12, 2018
1 parent 3fcc3bc commit 128f76b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Object {
"date": "1984",
"title": "The world of slash and adventure",
},
"hair": 2,
"hair": 2048,
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe(`GraphQL type inferance`, () => {
id: `boo`,
name: `The Mad Wax`,
type: `Test`,
hair: 2,
hair: 2048,
date: `1984-10-12`,
anArray: [1, 2, 5, 4],
aNestedArray: [[1, 2, 3, 4]],
Expand Down
3 changes: 0 additions & 3 deletions packages/gatsby/src/schema/infer-graphql-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ export type ProcessedNodeType = {
}

const ISO_8601_FORMAT = [
`YYYY`,
`YYYY-MM`,
`YYYY-MM-DD`,
`YYYYMMDD`,
`YYYY-MM-DDTHHZ`,
`YYYY-MM-DDTHH:mmZ`,
`YYYY-MM-DDTHHmmZ`,
Expand All @@ -59,7 +57,6 @@ const ISO_8601_FORMAT = [
`YYYY-[W]WW-E`,
`YYYY[W]WWE`,
`YYYY-DDDD`,
`YYYYDDDD`,
]

function inferGraphQLType({
Expand Down

0 comments on commit 128f76b

Please sign in to comment.