Skip to content

feat(Calendar): week number#2031

Open
maxffarrell wants to merge 7 commits into
huntabyte:mainfrom
maxffarrell:feat/cal-week-number
Open

feat(Calendar): week number#2031
maxffarrell wants to merge 7 commits into
huntabyte:mainfrom
maxffarrell:feat/cal-week-number

Conversation

@maxffarrell

@maxffarrell maxffarrell commented Apr 18, 2026

Copy link
Copy Markdown
Contributor
Screenshot 2026-05-09 at 1 45 17 PM Adds a `showWeekNumbers` prop to `Calendar`, `RangeCalendar`, `DatePicker`, and `DateRangePicker`, along with two new primitives — `WeekNumberCell` and `WeekNumberHeadCell` — for rendering ISO 8601 week numbers in the calendar grid.

Week numbers use Thursday-anchored ISO 8601 calculation and include a leading zero for single-digit weeks.

New components

  • Calendar.WeekNumberCell / RangeCalendar.WeekNumberCell — renders the week number for a given row
  • Calendar.WeekNumberHeadCell / RangeCalendar.WeekNumberHeadCell — renders the column header for the week number column

Usage

<Calendar.Root showWeekNumbers>
  {#snippet children({ months, weekdays })}
    <Calendar.Header>...</Calendar.Header>
    {#each months as month}
      <Calendar.Grid>
        <Calendar.GridHead>
          <Calendar.GridRow>
            <Calendar.WeekNumberHeadCell />
            {#each weekdays as day}
              <Calendar.HeadCell>{day}</Calendar.HeadCell>
            {/each}
          </Calendar.GridRow>
        </Calendar.GridHead>
        <Calendar.GridBody>
          {#each month.weeks as weekDates}
            <Calendar.GridRow>
              <Calendar.WeekNumberCell {weekDates} />
              {#each weekDates as date}
                <Calendar.Cell {date} month={month.value}>
                  <Calendar.Day />
                </Calendar.Cell>
              {/each}
            </Calendar.GridRow>
          {/each}
        </Calendar.GridBody>
      </Calendar.Grid>
    {/each}
  {/snippet}
</Calendar.Root>

Docs and browser tests included.

maxffarrell and others added 3 commits April 17, 2026 17:49
…NumberHeadCell primitives

Adds ISO 8601 week number display support to Calendar and RangeCalendar.
Users opt in by setting showWeekNumbers on Root and placing the new
WeekNumberCell/WeekNumberHeadCell primitives in their template.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…adCell documentation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…Calendar

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Apr 18, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: e1de45c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

github-actions Bot commented Apr 18, 2026

Copy link
Copy Markdown
Contributor
built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
bits-ui ✅ Ready (View Log) Visit Preview e1de45c

Tests verify showWeekNumbers=false hides cells, showWeekNumbers=true renders
them, ISO week numbers are computed correctly (Jan 20→W3), and year boundaries
work (Dec 30, 2024→W01 of 2025 with weekStartsOn=1).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@maxffarrell maxffarrell marked this pull request as ready for review April 19, 2026 02:08
@maxffarrell maxffarrell changed the title feat: calendar week number feat(Calendar): week number Apr 19, 2026
…gePicker API schemas

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

2 participants