keystonejs / keystonejs/keystone
`calendarDay` won't accept default value
- Dominant language
- TypeScript
- Stars
- 10k
- Forks
- 1.3k
- Avg merge
- 19h 14m
- Merged PRs (30d)
- 19
Description
### 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"
```
Contributor guide
Assessment
This issue has not been assessed yet.