Week Picker

A week picker: a week-year of ISO 8601 weeks as a grid, each cell the week number with the Monday it starts on under it, that hands back a plain "2026-W07" string — the same value `<input type="week">` produces, for an input Firefox and Safari have never shipped. Reach for it wherever the thing being chosen is the week itself: a weekly report, export or digest; the period on a timesheet,工数 or overtime submission; a payroll or billing week; a weekly close, cut-off or freeze; sprint and iteration selection; a production, delivery or shipping week; a school or academic week; an on-call or shift rotation; the week a KPI, OKR or target is scored in; a cohort in a week-over-week retention table; and the period selector above any dashboard, chart or ledger that aggregates by week — often paired as two of them for a from/to range. Common asks it answers: "week picker react", "iso week picker", "week number picker component", "select a week react", "weekpicker shadcn", "shadcn week picker", "shadcn calendar select week", "input type=week alternative react", "week input safari firefox not supported", "MUI week picker equivalent", "antd DatePicker picker=week equivalent", "react-datepicker showWeekPicker alternative", "week range picker react", "pick a week for weekly report", "timesheet week selector react", "payroll week picker", "sprint week selector", "week over week dashboard period picker", "iso 8601 week component", "YYYY-Www input react", "get iso week number javascript", "iso week year vs calendar year", "week 53 bug", "year has 53 weeks javascript", "december week belongs to next year", "january week belongs to previous year", "week number off by one new year", "getWeek returns wrong year", "date-fns getISOWeek without date-fns", "week start monday vs sunday", "store a week not a date range", "accessible week picker", "grid roving tabindex week", "週 選択 react", "ISO週 コンポーネント", "週次レポート 期間選択", "勤怠 週 選択", "第53週 バグ", "週番号 年またぎ ずれ", "週の開始 月曜 日曜", "週単位 集計 ダッシュボード". Official shadcn/ui has no week selection, measured today rather than remembered. Fetching every entry in its registry — 65 listed, 62 fetchable, code-block, questionnaire and trace 404 on both style tracks — and searching all 223,287 bytes of files[].content, isoWeek, weekNumber, weekYear, getISOWeek, weekOfYear, ISO8601, fiscalWeek, weekStartsOn, startOfWeek and endOfWeek are every one of them a zero hit. week is not zero and is worth unfolding rather than rounding: it returns 10, and all 10 are react-day-picker className keys inside its calendar — weekdays, weekday, week, week_number_header, week_number. Official's calendar can therefore *display* a week number beside a row; what it selects is still a day. Being able to show a thing and being able to answer with it are different, and this component answers with it. The decision everything else follows from: a week-year is not a calendar year, and the two are kept as separate numbers because the days do not agree with either. Measured, not recalled: 2026-12-28 is a Monday and 2027-01-03 is a Sunday and both are 2026-W53; the week-year only turns over on 2027-01-04; and 2026 is one of the years with fifty-three weeks — 1992, 1998, 2004, 2009, 2015, 2020, 2026, 2032 and 2037 in this span, measured by the gap between consecutive week-1 Mondays rather than by reciting which weekday 1 January fell on. So nothing here is ordered by (year, week). Every move is made over the Monday that opens a week, counted as whole days from the epoch, which is why the arrow keys walk out of W53 into the next year's W01 without a special case and why adding a week never lands on the wrong day in the two weeks a year that daylight saving moves — a week is seven calendar days, not 604,800,000 milliseconds. PageUp and PageDown hold the week number and walk the years, clamped where the year they arrive in is shorter, so W53 never lands on a cell that does not exist. parseWeekValue does the validation a regular expression cannot: "2025-W53" is shaped exactly like a week and is nothing, because 2025 has fifty-two, and a picker that accepts it opens on a cell nobody can select. A min or max that is not a real week is treated as no bound rather than as a silent lock-out. weekDates is the one accessor it hands out, and the type is why that is safe. month-picker deliberately returns no Date, because an instant means having quietly chosen a zone; the same objection holds here, so a week resolves to two inclusive "YYYY-MM-DD" calendar dates — zone-free, sortable, and what an API means by ?from=2026-02-09. The end is inclusive because half of all range bugs are an argument about the eighth day. weekDates("2026-W53") answers 2026-12-28 to 2027-01-03: one week, two calendar years, and the shape to test any week-to-dates code against. toWeekValue reads a Date's local fields and never toISOString, which is a month-picker lesson applied one grain finer: UTC is already Monday at 23:00 on a Sunday in Berlin, so the ISO read files a weekly timesheet against the following period for everyone who submits one on a Sunday evening. The dates under the numbers are localised, and the calendar they are written in is pinned to the one the ISO week is defined on. Not fussiness, and measured: asked to write 9 February 2026, th-TH answers 2569, ja-JP-u-ca-japanese answers 令和8年, ar-EG answers in Arabic-Indic digits and fa-IR answers 20 Bahman 1404 — a different day of a different month. Any of those under a cell whose value is "2026-W07" leaves the label and the value disagreeing with no way for the reader to tell which one the form posts. Language and date order still follow the locale; only the calendar is held still. It is pinned through Intl.Locale rather than by appending "-u-ca-gregory" to the tag, because a locale that already carries an extension — ja-JP-u-ca-japanese is the common one — becomes an invalid tag that way and throws, and the fallback then loses the reader's language entirely. A malformed locale prop falls back instead of taking the page down. The word "week" in each cell's accessible name comes from CLDR through Intl.DisplayNames, so it reads 週 in Japanese and Woche in German: a component that localises its dates and then announces them as "Week 7" is only half translated. The week-year in the caption is written as a plain number rather than through Intl, because that is the number the form will post. Accessibility is the other half of the work. It is a real role="grid" with a roving tabindex — one tab stop for the whole year, then the arrow keys inside it, because fifty-three tab stops per year is the thing this replaces. Left and right step a week and cross into the neighbouring week-year at the edges rather than dead-ending, up and down move a row and follow the columns prop, Home and End go to the first and last week of the year since rows here are a layout choice and not a calendar unit, and on an RTL page left and right follow the writing direction instead of running backwards. Every cell is named with the localised word, the number and the whole range — "week 7, Feb 9 – 15, 2026" — because a bare number stops meaning anything once the arrows have moved, and the date printed under it is aria-hidden so the same date is not read twice. The current week carries aria-current="date". Unavailable weeks are marked aria-disabled rather than with the disabled attribute, so they can still be reached and read: a week the arrow keys skip over silently is a week the user cannot tell exists. Both the locale and the which-week-is-now marker resolve after mount, so a server render and the browser's first paint agree instead of tripping a hydration mismatch, and passing locale skips the swap. Within this registry the neighbours are each another grain or another job: month-picker is the same shape one step coarser, date-range-preset picks an arbitrary period rather than a named week, calendar-heatmap draws a year of days instead of choosing one of its weeks, weekly-hours sets the opening times a business keeps on each weekday, date-input types a single day, time-slot-picker chooses between times inside a day, duration-input measures a length and timezone-select picks a zone. None of them answers with a week. The API: value and onValueChange make it controlled, or defaultValue uncontrolled; weekYear, defaultWeekYear and onWeekYearChange control the year on display; min and max take the same YYYY-Www strings and stop the year arrows as well as the cells; isWeekDisabled handles scattered holes such as a closed payroll period without locking the arrows; locale, columns (3, 4 or 6) and formatWeekLabel cover the display; and name posts the value through a hidden input with a plain form or a server action. The arithmetic is exported as pure functions so a report, a server route, a reminder job or a test can have the same answers without mounting anything: toWeekValue, parseWeekValue, weekDates, weeksInWeekYear and shiftWeekValue. Styled entirely with shadcn tokens (primary, primary-foreground, accent, accent-foreground, input, ring, muted-foreground) so it follows light and dark mode, and it ships zero npm dependencies — no date library, no icon package, one file.

Usage docs and preview are being generated by the coding agent. Registry metadata is shown meanwhile.
building preview…
The live preview has not been built yet.
See how it was built

Installation

pnpm dlx shadcn@latest add @pulld/week-picker

Requires @pulld in the registries of your components.json (shadcn adds official directory namespaces automatically).

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "Week Picker" component (pulld/week-picker) from its shadcn registry.1. Install it with: npx shadcn@latest add @pulld/week-picker2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.

Files & dependencies

  • registry/ui/week-picker.tsx

Looks similar, elsewhere

There is no screenshot of this item to compare yet.