Skip to content

Instantly share code, notes, and snippets.

View sdawood's full-sized avatar

Shaady Dawood sdawood

View GitHub Profile
@sdawood
sdawood / GraphQLMoment.js
Created January 22, 2022 09:16 — forked from rijvirajib/GraphQLMoment.js
A GraphQL Date type using Moment as the parser allowing for any date input, formatted using moment.format()
import moment from 'moment';
import {GraphQLScalarType, GraphQLError, Kind} from 'graphql';
module.exports = new GraphQLScalarType({
name: 'Date',
/**
* Serialize date value into string
* @param {moment} value date value
* @return {String} date as string
*/