PHPackages                             digiaonline/graphql-datetime-scalar - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. digiaonline/graphql-datetime-scalar

AbandonedArchivedLibrary[API Development](/categories/api)

digiaonline/graphql-datetime-scalar
===================================

Date, Time and DateTime scalar types for our GraphQL implementation

1.0.0(7y ago)29.0kMITPHPPHP &gt;=7.1

Since Sep 22Pushed 7y agoCompare

[ Source](https://github.com/digiaonline/graphql-datetime-scalar-php)[ Packagist](https://packagist.org/packages/digiaonline/graphql-datetime-scalar)[ RSS](/packages/digiaonline-graphql-datetime-scalar/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

graphql-datetime-scalar-php
===========================

[](#graphql-datetime-scalar-php)

[![Build Status](https://camo.githubusercontent.com/9504c570372a20ee0005d66c3f9d42879c9134852fd573c53357c28476d941c8/68747470733a2f2f7472617669732d63692e6f72672f64696769616f6e6c696e652f6772617068716c2d6461746574696d652d7363616c61722d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/digiaonline/graphql-datetime-scalar-php)[![Coverage Status](https://camo.githubusercontent.com/990be2b91138843ad6de966357e0f72e5034ba0be2f2e4d7017dfaea3f58f971/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f64696769616f6e6c696e652f6772617068716c2d6461746574696d652d7363616c61722d7068702f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/digiaonline/graphql-datetime-scalar-php?branch=master)

Date, Time and DateTime scalar types for our [GraphQL implementation](https://github.com/digiaonline/graphql-php/)

Introduction
------------

[](#introduction)

Most GraphQL APIs need a way to represent dates, times or timestamps of some sort. Since there is no native date type in GraphQL, people have to resort to rolling their own. To reduce the boilerplate required, this library provides a few basic scalar types that should cover most situations.

Requirements
------------

[](#requirements)

- PHP &gt;= 7.1
- [digiaonline/graphql](https://github.com/digiaonline/graphql-php/)

Usage
-----

[](#usage)

Installation the library using Composer:

```
composer require digiaonline/graphql-datetime-scalar
```

When wiring up your executable schema, simply pass in the types you need:

```
$executableSchema = buildSchema($schemaDefinition, [
    'Query'    => QueryResolver::class,
    'Mutation' => MutationResolver::class,
], [
    'types' => [
        new DateScalarType(),
        new TimeScalarType(),
        new DateTimeScalarType(),
    ],
]);
```

While it's not strictly necessary it might be a good idea to also mention in your schema that these types exist:

```
scalar Date
scalar Time
scalar DateTime
```

You can specify the format by passing a format string to the constructor:

```
$dateType     = new DateScalarType('j.n.Y'); // 31.12.2018
$timeType     = new TimeScalarType('H:i'); // 14:35
$dateTimeType = new DateTimeScalarType('U'); // 1537361927
```

Like the built-in scalar types, if a value cannot be serialized or parsed correctly into a `\DateTimeInterface`, a `\Digia\GraphQL\Error\InvalidTypeException` will be thrown.

License
-------

[](#license)

MIT

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2834d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d7e28ec3bf2ff3ffcdd8c947f54d53d4dae86939bea2a7316cfde0b10410e9ee?d=identicon)[Jalle19](/maintainers/Jalle19)

---

Top Contributors

[![Jalle19](https://avatars.githubusercontent.com/u/1106133?v=4)](https://github.com/Jalle19 "Jalle19 (1 commits)")

---

Tags

graphqlphp

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/digiaonline-graphql-datetime-scalar/health.svg)

```
[![Health](https://phpackages.com/badges/digiaonline-graphql-datetime-scalar/health.svg)](https://phpackages.com/packages/digiaonline-graphql-datetime-scalar)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93452.6k6](/packages/botman-driver-telegram)[pixelant/pxa-social-feed

Add Facebook, Instagram, and Twitter feeds to your site.

2349.3k](/packages/pixelant-pxa-social-feed)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
