Skip to content

fix: reject impossible calendar dates across catalog checks - #48

Merged
TMHSDigital merged 1 commit into
TMHSDigital:mainfrom
Sonike:fix/reject-impossible-calendar-dates
Sep 26, 2026
Merged

TMHSDigital merged 1 commit into
TMHSDigital:mainfrom
Sonike:fix/reject-impossible-calendar-dates

Conversation

@Sonike

@Sonike Sonike commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Summary

verified: 2025-13-01 and verified: 2026-02-30 previously passed validation. JavaScript could then normalize an impossible date into another month when calculating freshness.

Add a shared isRealDate helper that checks strict YYYY-MM-DD syntax and round-trips the UTC year/month/day, including years 0000–0099 without the 1900 offset. Use it for catalog verification dates, Evidence dates, stack walked dates, and freshness calculations. Invalid Evidence dates are reported even when the section also contains valid dates; they cannot become its newest evidence. Invalid freshness dates produce the existing unknown-date result.

Regression coverage includes month/day overflow, leap years and century rules, strict input shape, valid leap-day stacks/evidence, and all affected consumers.

Closes #10

Validation

Node.js v24.20.0:

  • node site/checks.test.mjs: 72 assertions passed.
  • node site/lib/lib.test.mjs: 267 assertions passed.
  • node site/validate.mjs: 319 entries, 319 unique IDs, 5 stacks, no broken links.
  • node site/build.mjs: passed; generated entry pages, stack pages and freshness page checks passed.
  • git diff --check, git diff --cached --check, and git diff --check origin/main...HEAD: passed.

Before the fix, the added consumer regressions produced 6 catalog-check failures and 9 site-module failures. Separately, temporarily replacing a catalog entry's verified field with each reported impossible date made node site/validate.mjs exit 0 before the fix and exit 1 with a real-calendar-date diagnostic afterward. The original entry was restored after the checks.

Type

  • New catalog entry
  • License / metadata correction
  • Docs or site

Checklist

  • node site/validate.mjs passes
  • Catalog entries, their license metadata and expectedEntryCount are unchanged; the entry-specific checklist items do not apply.

AI assistance: OpenAI Codex implemented the fix and tests, reviewed the patch, and executed the validation above.

@TMHSDigital

Copy link
Copy Markdown
Owner

Thank you, this is a careful fix: the years 0000-0099 case and making freshness ignore impossible dates are both things my own pass in #49 missed. Tests, validate and build all pass locally. Merging this first; #49 will build on your isRealDate.

@TMHSDigital
TMHSDigital merged commit ed697b2 into TMHSDigital:main Sep 26, 2026
2 checks passed
TMHSDigital added a commit that referenced this pull request Sep 26, 2026
#48 fixed impossible dates (#10) independently. Keep its isRealDate,
which also handles years 0000-0099 and non-strings, and its messages
("is not a real YYYY-MM-DD date"); drop this branch's copy. Keep this
branch's evidenceDates (dates inside URLs ignored) and
latestAllowedDate. Both test suites pass together: 101 check and 296
lib assertions.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wc67NX9MM964uaVGn4bpZJ
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.

validate: impossible dates pass (2025-13-01, 2026-02-30)

2 participants