2.2.45 • Published 3 years ago

graphql-joda-types v2.2.45

Weekly downloads
20,044
License
MIT
Repository
github
Last release
3 years ago

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.

2.2.44

3 years ago

2.2.45

3 years ago

2.2.42

3 years ago

2.2.43

3 years ago

2.2.40

3 years ago

2.2.41

3 years ago

2.2.28

3 years ago

2.2.29

3 years ago

2.2.26

3 years ago

2.2.27

3 years ago

2.2.24

3 years ago

2.2.25

3 years ago

2.2.22

3 years ago

2.2.23

3 years ago

2.2.21

3 years ago

2.2.39

3 years ago

2.2.37

3 years ago

2.2.38

3 years ago

2.2.35

3 years ago

2.2.36

3 years ago

2.2.33

3 years ago

2.2.34

3 years ago

2.2.31

3 years ago

2.2.32

3 years ago

2.2.30

3 years ago

2.2.18

3 years ago

2.2.19

3 years ago

2.2.20

3 years ago

2.2.17

3 years ago

2.2.15

3 years ago

2.2.16

3 years ago

2.2.13

3 years ago

2.2.14

3 years ago

2.2.12

3 years ago

2.2.11

4 years ago

2.2.7

4 years ago

2.2.10

4 years ago

2.2.9

4 years ago

2.2.8

4 years ago

2.1.18

4 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.2.3

4 years ago

2.2.2

4 years ago

2.2.5

4 years ago

2.2.4

4 years ago

2.2.6

4 years ago

2.1.16

4 years ago

2.1.17

4 years ago

2.1.15

4 years ago

2.1.14

4 years ago

2.1.13

4 years ago

2.1.12

4 years ago

2.1.9

4 years ago

2.1.4

4 years ago

2.1.3

4 years ago

2.1.6

4 years ago

2.1.5

4 years ago

2.1.10

4 years ago

2.1.8

4 years ago

2.1.11

4 years ago

2.1.7

4 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.1

5 years ago

2.0.1-alpha2

5 years ago

2.0.1-alpha

5 years ago

2.0.0-alpha

5 years ago

2.0.0

5 years ago

1.0.0

7 years ago