Skip to content

Add Date property type#836

Draft
malberts wants to merge 2 commits into
masterfrom
feature/788-date-property-type
Draft

Add Date property type#836
malberts wants to merge 2 commits into
masterfrom
feature/788-date-property-type

Conversation

@malberts
Copy link
Copy Markdown
Contributor

@malberts malberts commented May 16, 2026

Fixes #788

Adds a calendar date property type (a date with no time or timezone component), parallel to the existing dateTime type (#678) and distinct from the planned EDTF type (#679).

Behavior

Values are strict ISO 8601 calendar dates in YYYY-MM-DD form. Rejected: values carrying a time/timezone component (2025-06-15T00:00:00Z), partial values (year-only 2025, year-month 2025-06), and calendar overflows (2025-02-30, Feb 29 in a non-leap year). Optional inclusive minimum/maximum bounds follow the same shape rules.

Backend

  • DateType property type and DateProperty schema definition, mirroring the DateTime equivalents with a date-only regex plus a checkdate calendar-overflow guard.
  • Registered in PropertyTypeRegistry::withCoreTypes() and as a Neo4j scalar builder in Neo4jValueBuilderRegistry::withCoreBuilders().

Frontend

  • Date.ts (validation, strict parsing, locale display formatting), dateConversion.ts (parse-guarded <input type="date"> wire conversion), and DateInput / DateDisplay / DateAttributesEditor Vue components.
  • Registered in Neo.ts, NeoWikiExtension.ts (calendar icon) and exported from public-api.ts.
  • extension.json: cdxIconCalendar added to the CodexModule::getIcons allowlist so the type-picker icon resolves at MediaWiki runtime (see commit 2).

i18n

neowiki-property-type-date label and neowiki-field-invalid-date validation message, with qqq documentation and extension.json message registration.

Tests

PHP DateTypeTest, DatePropertyTest, a date builder assertion in Neo4jValueBuilderRegistryTest, and CodexIconRegistrationTest (regression guard for the icon-allowlist class of bug). TS specs for the domain type, conversion helpers, and all three Vue components.

Commits

  1. Add Date property type — the feature (backend + frontend + i18n + tests).
  2. Register cdxIconCalendar for ResourceLoader — fixes a defect found during browser verification (see below) plus its regression test.

Verification

  • PHP: DateTypeTest, DatePropertyTest, Neo4jValueBuilderRegistryTest, CodexIconRegistrationTest pass; phpcs clean; phpstan level 9 reports no errors.
  • JS: full suite (863 tests + 81 new) passes; eslint clean; vue-tsc typecheck clean.
  • review-tests mutation testing run on all new test files: all realistic mutations caught (2 provably-equivalent survivors, documented).
  • Browser verification (dedicated isolated stack): done end-to-end in a fresh per-worktree MediaWiki stack. Confirmed: "Date" appears in the schema-editor type picker with its calendar icon; the property editor adapts to native <input type="date"> Range (min/max) + initial-value fields. This caught a real bug: cdxIconCalendar was missing from the extension.json CodexModule icon allowlist, so the Date type rendered with no icon at MediaWiki runtime (unit/component tests passed because vitest resolves the real npm package, not the curated runtime icons.json). Fixed in commit 2 and re-verified in-browser; a regression test now guards this.

🤖 Generated with Claude Code

morne-tools and others added 2 commits May 17, 2026 01:31
Fixes #788

Adds a calendar `date` property type (a date with no time or timezone
component), parallel to the existing `dateTime` type (#678) and distinct
from the planned EDTF type (#679).

Values are strict ISO 8601 calendar dates in `YYYY-MM-DD` form. Values
carrying a time/timezone component, partial values (year-only,
year-month), and calendar overflows (e.g. `2025-02-30`, Feb 29 in a
non-leap year) are rejected. Optional inclusive `minimum`/`maximum`
bounds follow the same shape rules.

Backend:
- `DateType` property type and `DateProperty` schema definition, mirroring
  the DateTime equivalents with a date-only regex plus a `checkdate`
  calendar-overflow guard.
- Registered in `PropertyTypeRegistry::withCoreTypes()` and as a Neo4j
  scalar builder in `Neo4jValueBuilderRegistry::withCoreBuilders()`.

Frontend:
- `Date.ts` (validation, strict parsing, locale display formatting),
  `dateConversion.ts` (parse-guarded `<input type="date">` wire
  conversion), and `DateInput` / `DateDisplay` / `DateAttributesEditor`
  Vue components.
- Registered in `Neo.ts`, `NeoWikiExtension.ts` (calendar icon) and
  exported from `public-api.ts`.

i18n: `neowiki-property-type-date` label and `neowiki-field-invalid-date`
validation message, with qqq documentation and extension.json message
registration.

Tests: PHP `DateTypeTest`, `DatePropertyTest`, and a `date` builder
assertion in `Neo4jValueBuilderRegistryTest`; TS specs for the domain
type, conversion helpers, and all three Vue components.

Verification: full PHP unit suite for the new/changed files, phpcs, and
phpstan level 9 all pass; full JS suite (863 tests, incl. 81 new) passes
with eslint and vue-tsc clean. Browser verification is blocked: the
running dev stack is bind-mounted to a separate checkout and the worktree
cannot be deployed to it without intrusively rebuilding that checkout's
assets; the new Vue components are instead covered by component-level
tests asserting the rendered DOM and behavior.

Identified with Claude Code

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ders

Browser verification of the Date property type surfaced that its type-picker
icon did not render, while every other type's did.

Root cause: the frontend bundle externalises `@wikimedia/codex-icons` and, at
MediaWiki runtime, resolves it to a curated `icons.json` produced by
`CodexModule::getIcons` from the allowlist in extension.json. `cdxIconCalendar`
(used by the new Date type in NeoWikiExtension.ts) was not in that allowlist,
so it resolved to `undefined` and the icon silently disappeared. Unit/component
tests did not catch this because under vitest the import resolves against the
real `@wikimedia/codex-icons` npm package, not the curated runtime list.

Fix: add `cdxIconCalendar` to the CodexModule icon allowlist in extension.json.

Also adds CodexIconRegistrationTest, a regression guard asserting that
property-type icons (Date's cdxIconCalendar, Date & Time's cdxIconClock) are
present in the extension.json CodexModule allowlist. Verified it fails when the
allowlist entry is removed and passes once restored.

Identified with Claude Code

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.

Add date property type

1 participant