# graphql-joda-types

> js-joda types for GraphQL

Latest version **2.2.45** (published 2022-04-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install graphql-joda-types
pnpm add graphql-joda-types
yarn add graphql-joda-types
bun add graphql-joda-types
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.45 |
| Published | 2022-04-11 |
| First published | 2018-06-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 12.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Meetup |
| Maintainers | meetupbot |

## Links

- npm: https://www.npmjs.com/package/graphql-joda-types
- Repository: https://github.com/meetup/graphql-joda-types
- Homepage: https://github.com/meetup/graphql-joda-types#readme
- Issues: https://github.com/meetup/graphql-joda-types/issues
- npm.io page: https://npm.io/package/graphql-joda-types

## Dependencies (1)

- [@js-joda/core](https://npm.io/package/@js-joda/core.md) ^3.2.0 || ^4.0.0 || ^5.0.0

## Recent versions

- 2.2.45 (latest) — 2022-04-11
- 2.2.44 — 2022-04-11
- 2.2.43 — 2022-04-11
- 2.2.42 — 2022-03-28
- 2.2.41 — 2022-03-25
- 2.2.40 — 2022-03-25
- 2.2.39 — 2022-02-16
- 2.2.38 — 2022-02-08
- 2.2.37 — 2022-02-03
- 2.2.36 — 2022-02-03
- 2.2.35 — 2022-01-21
- 2.2.34 — 2022-01-21
- 2.2.33 — 2022-01-21
- 2.2.32 — 2022-01-13
- 2.2.31 — 2022-01-13
- … 56 more at https://npm.io/package/graphql-joda-types/versions

## README

# graphql-joda-types  <!-- omit in toc -->

[![npm](https://img.shields.io/npm/v/graphql-joda-types.svg)](https://www.npmjs.com/package/graphql-joda-types)
[![main](https://github.com/meetup/graphql-joda-types/actions/workflows/main.yml/badge.svg)](https://github.com/meetup/graphql-joda-types/actions/workflows/main.yml)
[![Coverage Status](https://coveralls.io/repos/github/meetup/graphql-joda-types/badge.svg?branch=master)](https://coveralls.io/github/meetup/graphql-joda-types?branch=master)

This is a small JavaScript library allowing you to use the date/time types from [`js-joda`][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](#supported-types)
- [Usage](#usage)

## Supported Types

The following `js-joda` types are currently supported:

- [`LocalDate`](https://js-joda.github.io/js-joda/esdoc/class/src/LocalDate.js~LocalDate.html)
- [`LocalDateTime`](https://js-joda.github.io/js-joda/esdoc/class/src/LocalDateTime.js~LocalDateTime.html)
- [`LocalTime`](https://js-joda.github.io/js-joda/esdoc/class/src/LocalTime.js~LocalTime.html)
- [`ZonedDateTime`](https://js-joda.github.io/js-joda/esdoc/class/src/ZonedDateTime.js~ZonedDateTime.html)
- [`ZoneId`](https://js-joda.github.io/js-joda/esdoc/class/src/ZoneId.js~ZoneId.html)

## Usage

Installation is straightforward:

```bash
yarn add graphql-joda-types   # or use npm
```

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

```graphql
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:

```js
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.

[js-joda]: https://github.com/js-joda/js-joda
[graphql]: https://graphql.org/
[graphql-iso-date]: https://www.npmjs.com/package/graphql-iso-date

---
_Source: https://npm.io/package/graphql-joda-types · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
