@parameter1/graphql-type-month
v1.0.10
Published
A custom Month GraphQL scalar type.
Downloads
12
Keywords
Readme
GraphQL Month Type
A custom MongoDB Month GraphQL scalar type, which parses values in YYYY-MM
format (e.g. 2021-03
)
Installation
yarn add @parameter1/graphql-type-month
Usage
Add the custom scalar to your resolvers and pass any desired options.
// resolvers.js
const GraphQLMonth = require('@parameter1/graphql-type-month');
module.exports = {
ObjectID: GraphQLMonth(),
// your resovlers here...
};
And to your GraphQL type definitions.
scalar Month
Configuration
The default timezone is UTC
. To change this, pass a timezone
value as a resolver option. The value can be any timezone supported by the dayjs
package.
// resolvers.js
const GraphQLMonth = require('@parameter1/graphql-type-month');
module.exports = {
ObjectID: GraphQLMonth({ timezone: 'America/Chicago' }),
// your resovlers here...
};