Add Date property type#836
Draft
malberts wants to merge 2 commits into
Draft
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #788
Adds a calendar
dateproperty type (a date with no time or timezone component), parallel to the existingdateTimetype (#678) and distinct from the planned EDTF type (#679).Behavior
Values are strict ISO 8601 calendar dates in
YYYY-MM-DDform. Rejected: values carrying a time/timezone component (2025-06-15T00:00:00Z), partial values (year-only2025, year-month2025-06), and calendar overflows (2025-02-30, Feb 29 in a non-leap year). Optional inclusiveminimum/maximumbounds follow the same shape rules.Backend
DateTypeproperty type andDatePropertyschema definition, mirroring the DateTime equivalents with a date-only regex plus acheckdatecalendar-overflow guard.PropertyTypeRegistry::withCoreTypes()and as a Neo4j scalar builder inNeo4jValueBuilderRegistry::withCoreBuilders().Frontend
Date.ts(validation, strict parsing, locale display formatting),dateConversion.ts(parse-guarded<input type="date">wire conversion), andDateInput/DateDisplay/DateAttributesEditorVue components.Neo.ts,NeoWikiExtension.ts(calendar icon) and exported frompublic-api.ts.extension.json:cdxIconCalendaradded to theCodexModule::getIconsallowlist so the type-picker icon resolves at MediaWiki runtime (see commit 2).i18n
neowiki-property-type-datelabel andneowiki-field-invalid-datevalidation message, with qqq documentation andextension.jsonmessage registration.Tests
PHP
DateTypeTest,DatePropertyTest, adatebuilder assertion inNeo4jValueBuilderRegistryTest, andCodexIconRegistrationTest(regression guard for the icon-allowlist class of bug). TS specs for the domain type, conversion helpers, and all three Vue components.Commits
Verification
DateTypeTest,DatePropertyTest,Neo4jValueBuilderRegistryTest,CodexIconRegistrationTestpass; phpcs clean; phpstan level 9 reports no errors.vue-tsctypecheck clean.<input type="date">Range (min/max) + initial-value fields. This caught a real bug:cdxIconCalendarwas missing from theextension.jsonCodexModule 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 runtimeicons.json). Fixed in commit 2 and re-verified in-browser; a regression test now guards this.🤖 Generated with Claude Code