2.0.0 • Published 1 year ago

graphql-edtf v2.0.0

Weekly downloads
16
License
AGPL-3.0
Repository
gitlab
Last release
1 year ago

graphql-edtf

Graphql Edtf Date Type

Installation

npm i --save graphql-edtf

Usage

Resolvers

const { Date, EdtfDate, EdtfInterval } = require('graphql-edtf')

const resolvers = {
  Date,
  EdtfDate,
  EdtfInterval
}

TypeDefs

const { gql } = require('apollo-server')

module.exports = gql`
  # Define scalar types for each
  scalar Date
  scalar EdtfDate
  scalar EdtfInterval

  type Person {
    id: ID!
    name: String
    aliveInterval: EdtfInterval
  }

  type Record {
    id: ID!
    name: String
    recordStartDate: EdtfDate # allows for fuzzy dates e.g. 1995? (i think the year is 1995)
  }

  type Tombstone {
    date: Date # graphql-date
  }

  type Query {
    person(id: String!): Person
    record(id: String!): Record
  }
`
2.0.0

1 year ago

1.0.0

4 years ago