Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calendarDay won't accept default value #8783

Open
beerdedfellow opened this issue Aug 24, 2023 · 2 comments
Open

calendarDay won't accept default value #8783

beerdedfellow opened this issue Aug 24, 2023 · 2 comments
Assignees
Labels
🐛 bug Unresolved bug dependencies Related to our dependencies

Comments

@beerdedfellow
Copy link

beerdedfellow commented Aug 24, 2023

Steps to reproduce

My apologies if this has been brought up. I've searched through the issues and found some that are related, but don't report this exactly. I have the following:

I have a Milestones schema/list with a field called due_date that is required. I am attempting to set a full-date string as the default value like the docs recommended:

            due_date: calendarDay({
                validation: { isRequired: true },
                defaultValue: '1970-01-01',
            }),

However, when I run keystone prisma migrate dev this produces the following error:

etDmmfError: Prisma schema validation - (get-dmmf wasm)
Error code: P1012
error: Error parsing attribute "@default": Parse error: "1970-01-01" is not a valid rfc3339 datetime string. (premature end of input)
  -->  schema.prisma:163
   | 
162 |   conversation Conversation[]       @relation("Conversation_milestone")
163 |   due_date     DateTime             @default("1970-01-01") @postgresql.Date
   | 

So I attempted to adjust the value to fit rfc3339 date-time format:

            due_date: calendarDay({
                validation: { isRequired: true },
                defaultValue: '1970-01-01T00:00:00.00Z',
            }),

I then receive the following error:

Error: The calendarDay field at Milestone.due_date specifies defaultValue: 1970-01-01T00:00:00.00Z but values must be provided as a full-date ISO8601 string such as 1970-01-01

Please describe what you expected to happen

calendarDay() field should accept ISO8601 full-date string format as a default value

Please add contextual information such as your node version (node -v), or the web browser you used

node ➜ /workspace/app (master) $ node -v
v18.16.0
    "dependencies": {
        "@graphql-tools/schema": "^10.0.0",
        "@keystone-6/auth": "^7.0.0",
        "@keystone-6/core": "^5.2.0",
        "@keystone-6/fields-document": "^8.0.0",
        "@prisma/client": "^4.14.1",
        "aws-cli": "^0.0.2",
        "typescript": "^5.0.4",
        "winston": "^3.8.2"
    },
    "devDependencies": {
        "@prisma/studio": "^0.484.0",
        "@types/node": "^20.2.5",
        "ts-node": "^10.9.1"
    },
    "os": [
        "linux",
        "darwin"
    ],
    "resolutions": {
        "next": "13.3.4"
@marekryb
Copy link
Contributor

FWIW, this is broken on Prisma level.

Workaround would be to add some kind of setting to calendarDay to not use native database types for postgresql and mysql. Error does not happen for sqlite because it uses String in this case.

@dcousens dcousens added dependencies Related to our dependencies 🐛 bug Unresolved bug labels Feb 8, 2024
@rivaslive
Copy link

Same issue here!

@dcousens dcousens self-assigned this May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Unresolved bug dependencies Related to our dependencies
Projects
None yet
Development

No branches or pull requests

4 participants