Repository navigation
Give the legal pages one header with a checked Last updated date - #1136
Open
noahkhomer18 wants to merge 2 commits into
Open
noahkhomer18 wants to merge 2 commits into
noahkhomer18 wants to merge 2 commits into
Conversation
Cookies and terms typed their formatted date by hand, so a mistyped bump went unnoticed. formatDay moves from the privacy page to legal-header.tsx with a LegalHeader component that renders the existing markup. Cookies and terms keep a PAGE_UPDATED constant like privacy, and privacy still checks the site's own date even when its own is later. Signed-off-by: Noah Khomer <108771853+noahkhomer18@users.noreply.github.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.
Closes #1130.
The cookies and terms pages typed their formatted "Last updated" date by hand, while privacy kept an ISO constant and checked it with
formatDay. Now all three go through one header.src/app/(site)/(legal)/legal-header.tsxholdsformatDay(moved from the privacy page) andLegalHeader({ title, updated }), which renders the existing<header>markup withformatDay(updated).PAGE_UPDATEDISO constant (2026-11-12,2026-10-31) and one<LegalHeader … />.LegalHeader. It still checks the site'slastUpdatedeven when its own date is later, in the page body, so the existingPrivacyPage()throw tests see it.formatDaytakes an optionalsourcefor the error, so the privacy additions still namelastUpdated in src/lib/privacy-additions.ts(the wordingprivacy/page.test.tsxexpects) and a page's own date namesPAGE_UPDATED.Rendered output is unchanged. I rendered each page with jsdom on
main(09127b0) and on this branch and comparedinnerHTML: privacy (no additions), privacy with a later additions date, cookies and terms are byte-for-byte identical.Tests (
legal-header.test.tsx): each page shows the formatted form of its ownPAGE_UPDATED(read from its source, since Next.js allows a page no extra exports, with the additions mocked tonullso a deployment's own file can't change the date), no page source contains a hand-typedLast updated:, andformatDayformats real days and refuses2026-02-30,2026-13-01,2026-00-10,1/12/2026,2026-1-01and'', naming the source. To check they bite, I broke one thing at a time: the header ignoring the page's date, terms going back to a hand-typed header,formatDayaccepting 30 February, and privacy no longer checking the site's date each fail tests.Checks:
pnpm lint,pnpm format:check,pnpm typecheckandpnpm knippass, and the legal pages' 32 tests pass. In the fullpnpm test, 2 tests insrc/i18n/testing/catalog-check.test.tsfail on my machine onmainas well (Node 24.22, ICU 78.3 / CLDR 48 plural rules), while CI onmainis green, so it's my local Node rather than this change.