@parameter1/graphql-type-month

1.0.10 • Public • Published

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...
};

Readme

Keywords

none

Package Sidebar

Install

npm i @parameter1/graphql-type-month

Weekly Downloads

3

Version

1.0.10

License

MIT

Unpacked Size

5.16 kB

Total Files

5

Last publish

Collaborators

  • brandonbk
  • zarathustra323
  • solocommand