Cannot set `timestamp` fields to null in Keystone admin panel

Open
#8,882 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
nodejs, typescript
Domain
frontend

Research direction

Start by reproducing the issue in the Keystone admin panel with a timestamp field, then compare clearing the value there with the GraphQL behavior. Check whether the same behavior occurs for calendarDay. Done means an existing item can be updated with the timestamp set to null while required timestamp validation remains unchanged.

Written by the indexing model from the issue text.

Description

Repro Steps

  1. create a model with a timestamp field (no options passed)
  2. go to admin panel and navigate to that model
  3. create one item and set some value for timestamp field
  4. remove the timestamp value
  5. hit the update button but throws an error saying that "[field x] requires a date to be selected"

Should be able to update and set null value for timestamp fields.
Also need to mention that this happens only on keystone panel and not the GraphQL.

I've tried { validation: { isRequired: false } } but didn't work neither.
We might have the same issue for calendarDay field as well.

Google Chrome: Version 118.0.5993.117 (Official Build) (64-bit)
Nodejs: v18.18.2

Package.json deps:

{
  "dependencies": {
    "@apollo/server-plugin-landing-page-graphql-playground": "^4.0.1",
    "@k6-contrib/list-plugins": "^5.1.0",
    "@keystone-6/auth": "^7.0.2",
    "@keystone-6/core": "^5.7.0",
    "@keystone-6/fields-document": "^8.0.2",
    "compression": "^1.7.4",
    "fast-jwt": "^3.3.1",
    "http-errors": "^2.0.0",
    "typescript": "^5.2.2"
  },
  "engines": {
    "node": "^18.18 || ^20.9"
  }
}
Dominant language
TypeScript
Stars
10k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
38

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from keystonejs/keystone

All issues in keystonejs/keystone

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.