Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<!-- END:nextjs-agent-rules -->
2 changes: 1 addition & 1 deletion components/datetime-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export function DateTimePicker({
onSelect={updateDate}
disabled={disabledDays}
locale={calendarLocale}
captionLayout="dropdown"
captionLayout="dropdown-months"
/>
<div className="flex items-center gap-2 border-t p-2.5">
<div className="flex min-w-0 flex-1 items-center gap-2">
Expand Down
22 changes: 22 additions & 0 deletions tests/lib/datetime-picker.test.js
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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(/<button[^>]+aria-label="Go to the Next Month"[^>]*>/)?.[0]

assert.ok(nextMonthButton)
assert.doesNotMatch(nextMonthButton, /aria-disabled="true"/)
})