Gathering detailed insights and metrics for graphql-datetime-with-offset
Gathering detailed insights and metrics for graphql-datetime-with-offset
Gathering detailed insights and metrics for graphql-datetime-with-offset
Gathering detailed insights and metrics for graphql-datetime-with-offset
GraphQL Scalar that parses dates from ISO 8601 format to { date: Date, offset: Number }
npm install graphql-datetime-with-offset
Typescript
Module System
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
2 Stars
35 Commits
1 Watchers
7 Branches
1 Contributors
Updated on Jan 20, 2025
Latest Version
2.0.4
Package Id
graphql-datetime-with-offset@2.0.4
Unpacked Size
38.65 kB
Size
7.27 kB
File Count
15
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
20
graphql-datetime-with-offset is a scalar type to be used with graphQL.js. From the client it accepts Dates in ISO 8601 format and parses them to { date: Date, offset: Number } format. It uses Luxon under the hood, and any ISO 8601 date specified should work with this scalar.
A basic understanding of GraphQL and of the graphQL.js implementation is needed to provide context for this library.
Install graphql-datetime-with-offset
using yarn
1yarn add graphql-datetime-with-offset
Or using npm
1npm install --save graphql-datetime-with-offset
Added option of using Luxon instance directly as GraphQLDateTimeLuxon
. Also means there's a breaking change where you have to require GraphQLDateTimeWithOffset
like this now:
const { GraphQLDateTimeWithOffset } = require('graphql-datetime-with-offset');
and if you want to use the Luxon instance directly:
const { GraphQLDateTimeLuxon } = require('graphql-datetime-with-offset');
This is an example of how to use it, also available in the /examples folder:
1const { ApolloServer, gql } = require('apollo-server'), 2 { GraphQLDateTimeWithOffset } = require('graphql-datetime-with-offset'); 3 4 5const data = { 6 events: [ 7 { 8 title: 'Meeting with Singapore Office', 9 dateWithOffset: { 10 date: new Date('2019-07-18T08:00:00.000Z'), 11 offset: 480, 12 }, 13 }, 14 { 15 title: 'Meeting with New York Office', 16 dateWithOffset: { 17 date: new Date('2019-07-18T16:00:00.000Z'), 18 offset: -300, 19 }, 20 }, 21 ], 22}; 23 24const typeDefs = gql` 25 scalar GraphQLDateTimeWithOffset 26 27 type Event { 28 title: String 29 dateWithOffset: GraphQLDateTimeWithOffset 30 } 31 32 type Query { 33 events: [Event] 34 } 35 36 type Mutation { 37 addEvent( 38 title: String 39 dateWithOffset: GraphQLDateTimeWithOffset 40 ): Event 41 } 42`; 43 44const resolvers = { 45 GraphQLDateTimeWithOffset, 46 Query: { 47 events: () => data.events, 48 }, 49 Mutation: { 50 addEvent: (_, args) => { 51 data.events = [ 52 ...data.events, 53 args, 54 ]; 55 return args; 56 }, 57 }, 58}; 59 60const server = new ApolloServer({ typeDefs, resolvers }); 61 62server.listen().then(({ url }) => { 63 console.log(`🚀 Server ready at ${url}`); 64});
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 0/20 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
58 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More