
Security News
OWASP 2025 Top 10 Adds Software Supply Chain Failures, Ranked Top Community Concern
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.
@jdrydn/graphql-datetime
Advanced tools
[](https://npm.im/@jdrydn/graphql-datetime) [](https://github.com/jdrydn/graphql-scalars/actions/workflows/ci
Standalone GraphQL Scalar type for Date values in JavaScript.
type User {
id: ID!
name: String!
createdAt: DateTime!
lastActiveAt: DateTime!
}
extend type Query {
user: User!
}
extend type Mutation {
setUserLastActiveAt(id: ID!, lastActiveAt: lastActiveAt!): Boolean!
}
$ npm install --save graphql @jdrydn/graphql-datetime
From your codebase, you can either use predefined items (type definition & resolver) directly in your project or define the scalar yourself & include the scalar instance in your resolvers.
The following example uses graphql-tools & the predefined items:
const assert = require('assert');
const { typeDefs: dateTimeTypeDefs, resolvers: dateTimeResolvers } = require('@jdrydn/graphql-datetime');
const typeDefs = /* GraphQL */`
type User {
id: ID!
name: String!
createdAt: DateTime!
lastActiveAt: DateTime!
}
extend type Query {
user: User!
}
extend type Mutation {
setUserLastActiveAt(id: ID!, lastActiveAt: lastActiveAt!): Boolean!
}
`;
const resolvers = {
Query: {
async user(_, { id }) {
const user = await getUser(id);
return user && user.id ? user : null;
},
},
Mutation: {
async setUserLastActiveAt(_, { id, lastActiveAt }) {
const user = await getUser(id);
assert(user && user.id, 'User not found');
// Set the last active at
user.lastActiveAt = lastActiveAt;
await setUser(id, user);
return true;
},
},
};
const schema = makeExecutableSchema({
typeDefs: [ typeDefs, dateTimeTypeDefs ],
resolvers: [ resolvers, dateTimeResolvers ],
});
Whereas this example uses apollo-server & includes the scalar instance DateTime in its resolvers:
const { ApolloServer } = require('apollo-server');
const { DateTime } = require('@jdrydn/graphql-datetime');
const typeDefs = /* GraphQL */`
type User {
id: ID!
name: String!
createdAt: DateTime!
lastActiveAt: DateTime!
}
extend type Query {
user: User!
}
extend type Mutation {
setUserLastActiveAt(id: ID!, lastActiveAt: lastActiveAt!): Boolean!
}
# @NOTE You must define the scalar yourself
scalar DateTime
`;
const resolvers = {
Query: {
async user(_, { id }) {
const user = await getUser(id);
return user && user.id ? user : null;
},
},
Mutation: {
async setUserLastActiveAt(_, { id, lastActiveAt }) {
const user = await getUser(id);
assert(user && user.id, 'User not found');
// Set the last active at
user.lastActiveAt = lastActiveAt;
await setUser(id, user);
return true;
},
},
DateTime,
};
const server = new ApolloServer({
typeDefs,
resolvers,
});
Once the type definition & resolver is configured, you can send & receive Date values in GraphQL in both queries & mutations.
query GetUser {
user(id: "1") {
id
name
lastActiveAt
}
}
{
"data": {
"user": {
"id": "1",
"name": "jdrydn",
"lastActiveAt": "2022-05-01T09:00:00.000Z"
}
}
}
mutation UpdateUser {
setUserLastActiveAt(id: "1", lastActiveAt: "2022-05-01T09:00:00.000Z")
}
{
"data": {
"setUserLastActiveAt": true
}
}
FAQs
[](https://npm.im/@jdrydn/graphql-datetime) [](https://github.com/jdrydn/graphql-scalars/actions/workflows/ci
The npm package @jdrydn/graphql-datetime receives a total of 2 weekly downloads. As such, @jdrydn/graphql-datetime popularity was classified as not popular.
We found that @jdrydn/graphql-datetime demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.