Skip to content

feat(admin): add date-only content field - #1365

Closed
masonjames wants to merge 4 commits into
emdash-cms:mainfrom
masonjames:codex/date-only-field-1097
Closed

masonjames wants to merge 4 commits into
emdash-cms:mainfrom
masonjames:codex/date-only-field-1097

Conversation

@masonjames

@masonjames masonjames commented Jun 5, 2026 •

Copy link
Copy Markdown
Contributor

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 date through 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 as TEXT in YYYY-MM-DD format and render as <input type="date">; existing datetime behavior is unchanged.

Type of change

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • User-visible strings in the admin UI are wrapped for translation (if applicable). Do not include messages.po changes except in translation PRs — a workflow extracts catalogs on merge to main.
  • I have added a changeset (if this PR changes a published package)
  • New features link to an approved Discussion: Date only field #1097

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: GPT-5 Codex; GPT-6 Codex refresh

Screenshots / test output

Validated locally:

pnpm lint:json | jq '.diagnostics | length'
pnpm typecheck
pnpm changeset status --since=origin/main
pnpm --filter @emdash-cms/admin exec vitest run tests/components/ContentEditor.test.tsx tests/components/RepeaterField.test.tsx tests/components/FieldEditor.test.tsx
pnpm --filter emdash exec vitest run tests/unit/schema/zod-generator.test.ts tests/unit/schema/registry.test.ts tests/unit/fields/all-fields.test.ts tests/unit/runtime/manifest-build.test.ts tests/unit/plugins/field-widgets.test.ts tests/integration/mcp/schema.test.ts
git diff --check

Refreshed against main fc4a7be4c: moved the date manifest mapping into the current handler and preserved the current combobox and URL validation behavior. Local validation: 202 core tests, 66 SQLite registry tests, and 161 admin browser tests passed; full build/typecheck passed and type-aware lint reported zero diagnostics. Native SQLite tests ran under Node 22. PostgreSQL and a fresh manual Arabic screenshot were not verified in this refresh.

@changeset-bot

changeset-bot Bot commented Jun 5, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e4f0f69

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

This PR includes changesets to release 12 packages
Name Type
emdash Patch
@emdash-cms/admin Patch
@emdash-cms/cloudflare Patch
@emdash-cms/plugin-test Patch
@emdash-cms/sandbox-workerd Patch
@emdash-cms/auth Patch
@emdash-cms/blocks Patch
create-emdash Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 Patch
@emdash-cms/auth-atproto Patch
@emdash-cms/plugin-embeds 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

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Scope check

This 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.

@github-actions github-actions Bot added the review/needs-review No maintainer or bot review yet label Jun 5, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jun 5, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@1365

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@1365

@emdash-cms/auth-atproto

npm i https://pkg.pr.new/@emdash-cms/auth-atproto@1365

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@1365

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@1365

@emdash-cms/contentful-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/contentful-to-portable-text@1365

emdash

npm i https://pkg.pr.new/emdash@1365

create-emdash

npm i https://pkg.pr.new/create-emdash@1365

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@1365

@emdash-cms/plugin-cli

npm i https://pkg.pr.new/@emdash-cms/plugin-cli@1365

@emdash-cms/plugin-test

npm i https://pkg.pr.new/@emdash-cms/plugin-test@1365

@emdash-cms/plugin-types

npm i https://pkg.pr.new/@emdash-cms/plugin-types@1365

@emdash-cms/registry-client

npm i https://pkg.pr.new/@emdash-cms/registry-client@1365

@emdash-cms/registry-lexicons

npm i https://pkg.pr.new/@emdash-cms/registry-lexicons@1365

@emdash-cms/registry-loader

npm i https://pkg.pr.new/@emdash-cms/registry-loader@1365

@emdash-cms/registry-moderation

npm i https://pkg.pr.new/@emdash-cms/registry-moderation@1365

@emdash-cms/registry-verification

npm i https://pkg.pr.new/@emdash-cms/registry-verification@1365

@emdash-cms/sandbox-workerd

npm i https://pkg.pr.new/@emdash-cms/sandbox-workerd@1365

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@1365

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@1365

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@1365

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@1365

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@1365

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@1365

@emdash-cms/plugin-field-kit

npm i https://pkg.pr.new/@emdash-cms/plugin-field-kit@1365

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@1365

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@1365

commit: e4f0f69

@masonjames
masonjames force-pushed the codex/date-only-field-1097 branch from bb9bdb6 to ecd1d98 Compare June 5, 2026 16:56

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. Timezone bug in toDateOnly (packages/core/src/fields/date.ts). When a Date object is passed to min/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.

  2. 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 static date() 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.

Comment thread packages/core/src/fields/date.ts
Comment thread packages/core/src/schema/zod-generator.ts
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Overlapping PRs

This PR modifies files that are also changed by other open PRs:

This may cause merge conflicts or duplicated work. A maintainer will coordinate.

@github-actions github-actions Bot added review/awaiting-author Reviewed; waiting on the author to respond review/needs-rereview New commits since the last review and removed review/needs-review No maintainer or bot review yet review/awaiting-author Reviewed; waiting on the author to respond labels Jun 5, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR has been inactive for 14 days. It will be closed automatically in 7 days if there is no further activity.

If you're still working on this, please push an update or leave a comment.

@github-actions github-actions Bot added the stale label Jun 27, 2026
@github-actions github-actions Bot mentioned this pull request Sep 23, 2026
12 of 19 tasks
@masonjames

Copy link
Copy Markdown
Contributor Author

Refreshed onto current main (7f20c8327) in e4f0f69e2.

Local validation passed for the full build, 161 focused admin tests, the changed MCP/schema integration coverage, package typecheck, zero-diagnostic type-aware lint, formatting, and git diff --check. The remaining local registry run is blocked by the checkout's Node native-module ABI mismatch; hosted CI has accepted the new head and is queued.

The branch is mergeable. Fresh rendered UI screenshots, including RTL, are still needed before this UI PR is ready for maintainer review.

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

This PR is waiting on its author because it has merge conflicts with main, and it has had no activity for 14 days. It will be closed in 7 days unless there is activity: push an update or leave a comment to keep it open.

@github-actions github-actions Bot added stale and removed stale labels Oct 9, 2026
@github-actions github-actions Bot removed the stale label Oct 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Closing after 21 days without activity while waiting on its author because it has merge conflicts with main. When you're ready to continue, reopen it, or comment here and a Project Team member will reopen it.

@github-actions github-actions Bot closed this Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant