Error with Schema.DateFromString in Response Schema

How can it be that, from this schema:
export const Task = Schema.Struct({
  id: TaskId,
  text: Schema.String,
  completed: Schema.Boolean,
  deletedAt: Schema.NullOr(Schema.DateFromString),
});

I'm getting the following error?
{
  "issues": [
    {
      "_tag": "Type",
      "path": [
        0,
        "deletedAt"
      ],
      "message": "Expected DateFromSelf, actual \"2025-07-24T07:11:58.051Z\""
    },
    {
      "_tag": "Type",
      "path": [
        0,
        "deletedAt"
      ],
      "message": "Expected null, actual \"2025-07-24T07:11:58.051Z\""
    }
  ],
  "message": "(<declaration schema> <-> ReadonlyArray<{ readonly id: <declaration schema>; readonly text: string; readonly completed: boolean; readonly deletedAt: DateFromString | null }>)\n└─ Type side transformation failure\n   └─ ReadonlyArray<{ readonly id: <declaration schema>; readonly text: string; readonly completed: boolean; readonly deletedAt: DateFromString | null }>\n      └─ [0]\n         └─ { readonly id: <declaration schema>; readonly text: string; readonly completed: boolean; readonly deletedAt: DateFromString | null }\n            └─ [\"deletedAt\"]\n               └─ DateFromString | null\n                  ├─ DateFromString\n                  │  └─ Type side transformation failure\n                  │     └─ Expected DateFromSelf, actual \"2025-07-24T07:11:58.051Z\"\n                  └─ Expected null, actual \"2025-07-24T07:11:58.051Z\"",
  "_tag": "HttpApiDecodeError"
}

Why is it complaining about DateFromSelf? It is supposed to be date from string. This is happening in an endpoint that uses this schema as response schema
Was this page helpful?