feat(admin): add date-only content field#1365
Conversation
🦋 Changeset detectedLatest commit: 1ceb8c8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 14 packages
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 |
Scope checkThis PR touches 24 files. PRs with a broad scope are harder to review. Please confirm the scope hasn't drifted beyond the intended change. If this scope is intentional, no action needed. A maintainer will review it. If not, please consider splitting this into smaller PRs. See CONTRIBUTING.md for contribution guidelines. |
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/auth-atproto
@emdash-cms/blocks
@emdash-cms/cloudflare
@emdash-cms/contentful-to-portable-text
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/plugin-cli
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/sandbox-workerd
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-field-kit
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
bb9bdb6 to
ecd1d98
Compare
There was a problem hiding this comment.
This is a well-scoped, additive feature that mirrors the existing datetime field to provide a date-only option. The implementation is thorough: it threads the new date type through the schema registry, runtime manifest, Zod validation, CLI, MCP tools, plugin manifests, and admin UI (ContentEditor, FieldEditor, RepeaterField). Tests cover the field factory, schema generation, registry column types, runtime manifest, repeater sub-fields, and MCP schema tools. A changeset is present, and all user-facing strings are wrapped for Lingui.
I found two issues:
-
Timezone bug in
toDateOnly(packages/core/src/fields/date.ts). When aDateobject is passed tomin/max,toISOString().slice(0, 10)can produce the wrong calendar date for timezones east of UTC (e.g.new Date('2026-02-26')in Tokyo becomes"2026-02-25"). This shifts the validation boundary by a day. -
Missing regex error message in generated schema (
packages/core/src/schema/zod-generator.ts). The runtime-generated Zod schema uses.regex(DATE_ONLY_PATTERN)without a custom message, while the staticdate()factory provides"Must be a date in YYYY-MM-DD format". API callers get a generic Zod error instead of the helpful message.
No security, SQL injection, auth, or locale-filtering issues were introduced. The approach is sound and the code is otherwise clean.
Overlapping PRsThis PR modifies files that are also changed by other open PRs:
This may cause merge conflicts or duplicated work. A maintainer will coordinate. |
What does this PR do?
Adds a first-class date-only field type for content models, so authors can collect just a calendar date without forcing a time value.
Discussion: #1097
This PR wires
datethrough the core schema registry, runtime manifest, schema validation, static field helper, MCP schema tools, plugin field-widget manifest validation, and the admin field editor/content editor. Date fields are stored asTEXTinYYYY-MM-DDformat and render as<input type="date">; existingdatetimebehavior is unchanged.Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runmessages.pochanges except in translation PRs — a workflow extracts catalogs on merge tomain.AI-generated code disclosure
Screenshots / test output
Validated locally: