diff --git a/AGENTS.md b/AGENTS.md index 7b33ff3..e8ebe7e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -106,8 +106,8 @@ Scale rigor to the change: a one-line fix needs a quick reviewer + tester pass; # This is NOT the Next.js you know -This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` before writing any code. Heed deprecation notices. +This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` (resolved from this file's directory; in monorepos the `next` package may not be visible from the repo root) before writing any code. Heed deprecation notices. -**Keep this block, including in commits.** It is part of the project's agent setup, maintained by `next dev` for every agent that works here. If it appears as an uncommitted change, that is intentional — commit it as-is. Do not remove it to clean up a diff; it will be regenerated. +This block is written and re-added by `next dev` — verify at `node_modules/next/dist/server/lib/generate-agent-files.js`. Removing it from a diff only re-creates the uncommitted change; committing it with your work keeps the tree clean. diff --git a/components/datetime-picker.tsx b/components/datetime-picker.tsx index 6eb7f6c..59228ca 100644 --- a/components/datetime-picker.tsx +++ b/components/datetime-picker.tsx @@ -155,7 +155,7 @@ export function DateTimePicker({ onSelect={updateDate} disabled={disabledDays} locale={calendarLocale} - captionLayout="dropdown" + captionLayout="dropdown-months" />
diff --git a/tests/lib/datetime-picker.test.js b/tests/lib/datetime-picker.test.js index e8bf8f5..763da49 100644 --- a/tests/lib/datetime-picker.test.js +++ b/tests/lib/datetime-picker.test.js @@ -1,6 +1,9 @@ import test from "node:test" import assert from "node:assert/strict" import fs from "node:fs" +import React from "react" +import { renderToStaticMarkup } from "react-dom/server" +import { DayPicker } from "react-day-picker" import { applyDateTimeBounds, @@ -93,3 +96,22 @@ test("DateTimePicker keeps the calendar date selected when clicked again", () => assert.equal(source.includes('mode="single"'), true) assert.equal(source.includes("required"), true) }) + +test("DateTimePicker does not cap navigation at the current year", () => { + const source = fs.readFileSync("components/datetime-picker.tsx", "utf8") + const captionLayout = source.match(/captionLayout="([^"]+)"/)?.[1] + + assert.equal(captionLayout, "dropdown-months") + + const markup = renderToStaticMarkup( + React.createElement(DayPicker, { + captionLayout, + month: new Date(2026, 11, 1), + today: new Date(2026, 7, 9), + }), + ) + const nextMonthButton = markup.match(/]+aria-label="Go to the Next Month"[^>]*>/)?.[0] + + assert.ok(nextMonthButton) + assert.doesNotMatch(nextMonthButton, /aria-disabled="true"/) +})