New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

graphql-joda-types

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-joda-types

js-joda types for GraphQL

  • 2.2.45
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
49
decreased by-3.92%
Maintainers
1
Weekly downloads
 
Created
Source

graphql-joda-types

npm main Coverage Status

This is a small JavaScript library allowing you to use the date/time types from js-joda in your GraphQL resolvers.

(We recommend js-joda for all JavaScript date/time code, but if you disagree, consider graphql-iso-date instead of this package.)

Supported Types

The following js-joda types are currently supported:

Usage

Installation is straightforward:

yarn add graphql-joda-types   # or use npm

You can then write something like the following in your schema:

scalar LocalDate
scalar ZonedDateTime
scalar ZoneId

type User {
  id: ID!
  name: String
  birthday: LocalDate
  timezone: ZoneId
  createdAt: ZonedDateTime
  updatedAt: ZonedDateTime
}

And then in your GraphQL server:

import { LocalDate, ZonedDateTime, ZoneId } from 'graphql-joda-types';
import { makeExecutableSchema } from '@graphql-tools/schema';

const schema = makeExecutableSchema({
  resolvers: {
    LocalDate,
    ZonedDateTime,
    ZoneId,
    // ...
  },
});

You will then be able to use js-joda date and time types as you expect in your other resolvers: input types will automatically be parsed to the appropriate object types, and when your resolvers return these types to clients, they will be stringified properly.

FAQs

Package last updated on 11 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc