Skip to content

Add DateTime min/max cross-validation and generalize minExceedsMax#733

Merged
alistair3149 merged 1 commit intomasterfrom
datetime-cross-validation
Apr 20, 2026
Merged

Add DateTime min/max cross-validation and generalize minExceedsMax#733
alistair3149 merged 1 commit intomasterfrom
datetime-cross-validation

Conversation

@JeroenDeDauw
Copy link
Copy Markdown
Member

@JeroenDeDauw JeroenDeDauw commented Apr 16, 2026

Fixes #730

DateTimeAttributesEditor.vue now refuses to emit an update when the
minimum timestamp exceeds the maximum and surfaces the existing
neowiki-property-editor-min-exceeds-max message on the offending
field, matching the behavior the number editor already had.

The comparison is a local 6-line helper that parses each input via
Date.parse and treats empty or unparseable input as "no value" so
typos don't produce spurious range errors. I considered generalizing
the existing minExceedsMax helper to take a parser callback (the
original plan in #730), but that turned out to be net-negative: the
two existing consumers (NumberAttributesEditor, TextAttributesEditor)
both already reduce to Number(...), so the generalization
parameterized a variation that didn't actually vary between current
consumers, while adding indirection at every call site. Keeping the
shared helper untouched and inlining DateTime's check reads more
simply.

Result of extensive back-and-forth with @JeroenDeDauw (including an explicit
course-correction away from the minExceedsMax refactor originally proposed
in #730).
Context: the NeoWiki codebase and the review of #685.
Written by Claude Code, Opus 4.7

@JeroenDeDauw JeroenDeDauw force-pushed the datetime-cross-validation branch from 14b8a71 to 886bd40 Compare April 16, 2026 23:25
@JeroenDeDauw JeroenDeDauw marked this pull request as ready for review April 16, 2026 23:34
@JeroenDeDauw JeroenDeDauw force-pushed the add-datetime-component-tests branch 2 times, most recently from ec06904 to d98d17e Compare April 17, 2026 00:01
Base automatically changed from add-datetime-component-tests to master April 20, 2026 19:21
@alistair3149 alistair3149 force-pushed the datetime-cross-validation branch 2 times, most recently from 7dba00b to 23a6a01 Compare April 20, 2026 19:38
Fixes #730

`DateTimeAttributesEditor.vue` now refuses to emit an update when the
minimum timestamp exceeds the maximum and surfaces the existing
`neowiki-property-editor-min-exceeds-max` message on the offending
field, matching the behavior the number editor already had.

The comparison is a local 6-line helper that parses each input via
`Date.parse` and treats empty or unparseable input as "no value" so
typos don't produce spurious range errors. I considered generalizing
the existing `minExceedsMax` helper to take a parser callback (the
original plan in #730), but that turned out to be net-negative: the
two existing consumers (`NumberAttributesEditor`, `TextAttributesEditor`)
both already reduce to `Number(...)`, so the generalization
parameterized a variation that didn't actually vary between current
consumers, while adding indirection at every call site. Keeping the
shared helper untouched and inlining DateTime's check reads more
simply.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@alistair3149 alistair3149 force-pushed the datetime-cross-validation branch from 23a6a01 to 86aa1be Compare April 20, 2026 19:40
@alistair3149 alistair3149 merged commit 45578f1 into master Apr 20, 2026
6 checks passed
@alistair3149 alistair3149 deleted the datetime-cross-validation branch April 20, 2026 19:42
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.

DateTime: min/max cross-validation and a value-agnostic minExceedsMax

2 participants