Skip to content

Fix custom date field validation failing on document edit#355

Merged
avitorio merged 3 commits intoavitorio:canaryfrom
mathieudutour:claude/fix-custom-date-field-LJ7CB
Apr 1, 2026
Merged

Fix custom date field validation failing on document edit#355
avitorio merged 3 commits intoavitorio:canaryfrom
mathieudutour:claude/fix-custom-date-field-LJ7CB

Conversation

@mathieudutour
Copy link
Copy Markdown
Contributor

  • Fix custom date fields failing validation when editing existing documents. Date values from frontmatter are ISO strings, but z.date() rejects non-Date values. Changed to z.coerce.date() (matching the existing z.coerce.number() pattern) so strings are automatically coerced to Date objects during schema validation.
  • Added test case verifying ISO date strings are coerced to Date objects.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Mar 24, 2026

@claude is attempting to deploy a commit to the andre Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 24, 2026

🦋 Changeset detected

Latest commit: a5eceee

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
outstatic Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mathieudutour mathieudutour force-pushed the claude/fix-custom-date-field-LJ7CB branch from 20b4a77 to 326b8ed Compare March 24, 2026 20:09
@avitorio
Copy link
Copy Markdown
Owner

Hey @mathieudutour the PR describes one thing but it seems to do another.
Were you getting erros with custom date field?

I like the idea of an iframe or youtube block, but not necessarily having it be a settings option.
I think I'll just ship the editor with it. Thoughts?

@mathieudutour mathieudutour force-pushed the claude/fix-custom-date-field-LJ7CB branch from 7686d93 to 7662940 Compare March 31, 2026 06:58
@mathieudutour
Copy link
Copy Markdown
Contributor Author

mathieudutour commented Mar 31, 2026

ah yep sorry, pushed something else on the branch. When editing a document that has a custom field of type date, you can't save it until you reenter the date in the custom field: it says that the field is of the wrong type (string instead of Date)

The youtube thing wasn't quite ready, it's on another PR here mathieudutour#4 if you'd like. Regarding the setting for it, I thought it'd be nicer because it requires some specific handling from the consumer - but if you think it's better by default, go for it

@avitorio avitorio merged commit 7be7c57 into avitorio:canary Apr 1, 2026
1 of 5 checks passed
@avitorio
Copy link
Copy Markdown
Owner

avitorio commented Apr 1, 2026

@mathieudutour thank you! Merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants