refactor: global namespace + admin pages UI
This commit is contained in:
21
server/graph/scalars/date.js
Normal file
21
server/graph/scalars/date.js
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
const gql = require('graphql')
|
||||
|
||||
module.exports = {
|
||||
Date: new gql.GraphQLScalarType({
|
||||
name: 'Date',
|
||||
description: 'ISO date-time string at UTC',
|
||||
parseValue(value) {
|
||||
return new Date(value)
|
||||
},
|
||||
serialize(value) {
|
||||
return value.toISOString()
|
||||
},
|
||||
parseLiteral(ast) {
|
||||
if (ast.kind !== gql.Kind.STRING) {
|
||||
throw new TypeError('Date value must be an string!')
|
||||
}
|
||||
return new Date(ast.value)
|
||||
}
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user