# Date picker

> A month that knows the shoot: shooting days numbered Day 1 to Day 24, days off, recces and today, so a date is chosen as “Day 7 of 24”, not just the 23rd.

Source: https://kwark.space/designSystem/components/date-picker

## Usage

### What it is
The date picker opens a month that already knows the production. Shooting days carry their number (*D7*) in the shoot colour from the [Production calendar](https://kwark.space/designSystem/components/production-calendar.md); days off inside the schedule are dashed; recces wear the recce colour; today has a dot. The field itself reads *Mon 23 Nov 2026* with a **Day 7 of 24** tag, so a person never has to count.

### When to use
- Choosing the date of a call sheet, a shooting day, a rehearsal, a recce or a deadline.
- Moving a scene to another day from the stripboard (the tag confirms which shooting day it lands on).

### When not to
- A date someone knows by heart and types faster than they pick (a birth date on a crew form): a text field with the format shown.
- A range of many days (*the whole Mumbai block*): pick the first and last shooting day with two fields, or select strips on the [Stripboard strip](https://kwark.space/designSystem/components/stripboard-strip.md).
- A time: the [Time picker](https://kwark.space/designSystem/components/time-picker.md) is a separate field.

### Shooting days, not just dates
- Shooting days are numbered in order across months (*D13* on 30 Nov, *D14* on 1 Dec). The number comes from the schedule; never compute it from the calendar.
- A day off is still choosable (a writer may book a reading on it), but choosing it for a shoot is an error with a way out: *Choose a shooting day, or add it to the schedule first.*
- Before a schedule exists, the month is plain and the tag is absent. Nothing is invented.

### All-day dates stay put
A shoot date is a calendar date at the location, stored as `2026-11-23`. Never store it as UTC midnight: someone opening the schedule in London would see the 22nd.

**Do:** *Mon 23 Nov 2026* with **Day 7 of 24**; in the month, D1–D6, a dashed Sunday off, D7–D12.

**Don't:** A bare `<input type="date">` that shows *23/11/2026* and leaves the 1st AD to count which shooting day that is.

### Writing
- The field shows weekday, day, month and year: *Mon 23 Nov 2026*. Week starts on Monday.
- Tags: *Day 7 of 24*, *Day off*, *Recce day*. Sentence case, figures not words.

## Style

### Anatomy

1. **Field**: 36px button (44 on touch) with a 16px calendar glyph, the date in 14px tabular figures, and the shoot tag: a pill in `--k-cal-shoot-bg` with `--k-cal-shoot-ink`, 600 12px. Open: `--k-accent-soft` edge.
2. **Popover**: `--k-surface`, 1px `--k-line`, 10px corners, `--k-shadow-pop` (it floats). 12px padding, up to 340px; full width under a thumb.
3. **Head**: previous and next month as 32px icon buttons; the month in 600 14px with the schedule summary under it (*Shoot · 24 days from 16 Nov*).
4. **Grid**: seven columns, Monday first, 2px gaps. Each day is a 40px button (44 on touch), 6px corners, the date in 500 14px tabular with an 11px note under it.
5. **Day kinds**: shoot (`--k-cal-shoot-bg` fill, ink text, *D7*), recce (`--k-cal-recce-bg`, *recce*), day off (1px dashed `--k-line-strong`, *off*), outside the month (50% opacity), today (a 5px dot in the corner).
6. **Chosen**: `--k-text` fill with `--k-bg` figures: the strongest mark on the month, in every room.
7. **Legend**: a 1px rule, then the three kinds as 12px keys and *Day 7 of 24* on the right.

### Tokens

| Token | Light | Dark |
|---|---|---|
| `--k-cal-shoot` | #826d35 | #c4b068 |
| `--k-cal-shoot-bg` | #f0ebd6 | #2d2919 |
| `--k-cal-shoot-ink` | #4d4019 | #e5d89e |
| `--k-cal-recce` | #4d6a7a | #83aac0 |
| `--k-cal-recce-bg` | #e6eef2 | #1e2930 |
| `--k-cal-recce-ink` | #2c4350 | #bad4e3 |
| `--k-surface` | #ffffff | #1a1a1a |
| `--k-raise` | #f1f5f9 | #252525 |
| `--k-line` | #e2e8f0 | rgba(255, 255, 255, .1) |
| `--k-line-strong` | var(--k-text-2) | var(--k-text-2) |
| `--k-text` | #0f172a | #e3e3e3 |
| `--k-text-2` | #5b6779 | #9ca3af |
| `--k-bg` | #f8fafc | #191919 |
| `--k-accent-soft` | #e8b58b | #e8b58b |
| `--k-danger` | #b4382c | #e0685c |
| `--k-shadow-pop` | 0 1px 2px rgba(15, 23, 42, .06), 0 12px 32px rgba(15, 23, 42, .12) | 0 2px 6px rgba(0, 0, 0, .2), 0 16px 36px rgba(0, 0, 0, .55) |
| `--k-radius-card` | 10px |  |
| `--k-radius-control` | 6px |  |
| `--k-fs-dense` | 11px |  |

## Code

### React

Use the HTML below with `kwark.css`. The example shows the markup and styling. Supply any application behavior described on this page.

### HTML and CSS

Works anywhere with `kwark.css`.

```html
<div class="kw-specimen-row">
<div class="kw-date"><span class="kw-label">Shoot date</span><button class="kw-date__field" type="button" aria-haspopup="dialog" aria-expanded="true" aria-label="Shoot date, Mon 23 Nov 2026, Day 7 of 24"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="18" height="18" rx="2"/><path d="M16 2v4M8 2v4M3 10h18"/></svg><span>Mon 23 Nov 2026</span><span class="kw-date__day">Day 7 of 24</span></button><div class="kw-pop kw-date__pop" role="dialog" aria-label="Choose a date">
  <div class="kw-date__head"><button class="kw-ibtn" type="button" aria-label="Previous month, October 2026"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg></button><p class="kw-date__month" aria-live="polite">November 2026<small>Shoot · 24 days from 16 Nov</small></p><button class="kw-ibtn" type="button" aria-label="Next month, December 2026"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg></button></div>
  <table class="kw-date__grid" role="grid" aria-label="November 2026"><thead><tr><th scope="col" abbr="Monday">Mo</th><th scope="col" abbr="Tuesday">Tu</th><th scope="col" abbr="Wednesday">We</th><th scope="col" abbr="Thursday">Th</th><th scope="col" abbr="Friday">Fr</th><th scope="col" abbr="Saturday">Sa</th><th scope="col" abbr="Sunday">Su</th></tr></thead>
  <tbody><tr><td><button class="kw-date__cell" type="button" data-outside tabindex="-1" aria-label="Monday 26 October"><span>26</span></button></td><td><button class="kw-date__cell" type="button" data-outside tabindex="-1" aria-label="Tuesday 27 October"><span>27</span></button></td><td><button class="kw-date__cell" type="button" data-outside tabindex="-1" aria-label="Wednesday 28 October"><span>28</span></button></td><td><button class="kw-date__cell" type="button" data-outside tabindex="-1" aria-label="Thursday 29 October"><span>29</span></button></td><td><button class="kw-date__cell" type="button" data-outside tabindex="-1" aria-label="Friday 30 October"><span>30</span></button></td><td><button class="kw-date__cell" type="button" data-outside tabindex="-1" aria-label="Saturday 31 October"><span>31</span></button></td><td><button class="kw-date__cell" type="button" tabindex="-1" aria-label="Sunday 1 November"><span>1</span></button></td></tr><tr><td><button class="kw-date__cell" type="button" tabindex="-1" aria-label="Monday 2 November"><span>2</span></button></td><td><button class="kw-date__cell" type="button" tabindex="-1" aria-label="Tuesday 3 November"><span>3</span></button></td><td><button class="kw-date__cell" type="button" tabindex="-1" aria-label="Wednesday 4 November"><span>4</span></button></td><td><button class="kw-date__cell" type="button" tabindex="-1" aria-label="Thursday 5 November"><span>5</span></button></td><td><button class="kw-date__cell" type="button" tabindex="-1" aria-label="Friday 6 November"><span>6</span></button></td><td><button class="kw-date__cell" type="button" tabindex="-1" aria-label="Saturday 7 November"><span>7</span></button></td><td><button class="kw-date__cell" type="button" tabindex="-1" aria-label="Sunday 8 November"><span>8</span></button></td></tr><tr><td><button class="kw-date__cell" type="button" tabindex="-1" aria-label="Monday 9 November"><span>9</span></button></td><td><button class="kw-date__cell" type="button" tabindex="-1" aria-label="Tuesday 10 November"><span>10</span></button></td><td><button class="kw-date__cell" type="button" tabindex="-1" aria-label="Wednesday 11 November"><span>11</span></button></td><td><button class="kw-date__cell" type="button" data-kind="recce" tabindex="-1" aria-label="Thursday 12 November, recce"><span>12</span><small>recce</small></button></td><td><button class="kw-date__cell" type="button" tabindex="-1" aria-label="Friday 13 November"><span>13</span></button></td><td><button class="kw-date__cell" type="button" tabindex="-1" aria-label="Saturday 14 November"><span>14</span></button></td><td><button class="kw-date__cell" type="button" tabindex="-1" aria-label="Sunday 15 November"><span>15</span></button></td></tr><tr><td><button class="kw-date__cell" type="button" data-kind="shoot" tabindex="-1" aria-current="date" aria-label="Monday 16 November, shoot day 1 of 24, today"><span>16</span><small>D1</small></button></td><td><button class="kw-date__cell" type="button" data-kind="shoot" tabindex="-1" aria-label="Tuesday 17 November, shoot day 2 of 24"><span>17</span><small>D2</small></button></td><td><button class="kw-date__cell" type="button" data-kind="shoot" tabindex="-1" aria-label="Wednesday 18 November, shoot day 3 of 24"><span>18</span><small>D3</small></button></td><td><button class="kw-date__cell" type="button" data-kind="shoot" tabindex="-1" aria-label="Thursday 19 November, shoot day 4 of 24"><span>19</span><small>D4</small></button></td><td><button class="kw-date__cell" type="button" data-kind="shoot" tabindex="-1" aria-label="Friday 20 November, shoot day 5 of 24"><span>20</span><small>D5</small></button></td><td><button class="kw-date__cell" type="button" data-kind="shoot" tabindex="-1" aria-label="Saturday 21 November, shoot day 6 of 24"><span>21</span><small>D6</small></button></td><td><button class="kw-date__cell" type="button" data-kind="off" tabindex="-1" aria-label="Sunday 22 November, day off"><span>22</span><small>off</small></button></td></tr><tr><td><button class="kw-date__cell" type="button" data-kind="shoot" aria-pressed="true" aria-label="Monday 23 November, shoot day 7 of 24"><span>23</span><small>D7</small></button></td><td><button class="kw-date__cell" type="button" data-kind="shoot" tabindex="-1" aria-label="Tuesday 24 November, shoot day 8 of 24"><span>24</span><small>D8</small></button></td><td><button class="kw-date__cell" type="button" data-kind="shoot" tabindex="-1" aria-label="Wednesday 25 November, shoot day 9 of 24"><span>25</span><small>D9</small></button></td><td><button class="kw-date__cell" type="button" data-kind="shoot" tabindex="-1" aria-label="Thursday 26 November, shoot day 10 of 24"><span>26</span><small>D10</small></button></td><td><button class="kw-date__cell" type="button" data-kind="shoot" tabindex="-1" aria-label="Friday 27 November, shoot day 11 of 24"><span>27</span><small>D11</small></button></td><td><button class="kw-date__cell" type="button" data-kind="shoot" tabindex="-1" aria-label="Saturday 28 November, shoot day 12 of 24"><span>28</span><small>D12</small></button></td><td><button class="kw-date__cell" type="button" data-kind="off" tabindex="-1" aria-label="Sunday 29 November, day off"><span>29</span><small>off</small></button></td></tr><tr><td><button class="kw-date__cell" type="button" data-kind="shoot" tabindex="-1" aria-label="Monday 30 November, shoot day 13 of 24"><span>30</span><small>D13</small></button></td><td><button class="kw-date__cell" type="button" data-kind="shoot" data-outside tabindex="-1" aria-label="Tuesday 1 December, shoot day 14 of 24"><span>1</span><small>D14</small></button></td><td><button class="kw-date__cell" type="button" data-kind="shoot" data-outside tabindex="-1" aria-label="Wednesday 2 December, shoot day 15 of 24"><span>2</span><small>D15</small></button></td><td><button class="kw-date__cell" type="button" data-kind="shoot" data-outside tabindex="-1" aria-label="Thursday 3 December, shoot day 16 of 24"><span>3</span><small>D16</small></button></td><td><button class="kw-date__cell" type="button" data-kind="shoot" data-outside tabindex="-1" aria-label="Friday 4 December, shoot day 17 of 24"><span>4</span><small>D17</small></button></td><td><button class="kw-date__cell" type="button" data-kind="shoot" data-outside tabindex="-1" aria-label="Saturday 5 December, shoot day 18 of 24"><span>5</span><small>D18</small></button></td><td><button class="kw-date__cell" type="button" data-kind="off" data-outside tabindex="-1" aria-label="Sunday 6 December, day off"><span>6</span><small>off</small></button></td></tr></tbody></table>
  <ul class="kw-date__legend"><li><i data-kind="shoot"></i>Shoot day</li><li><i data-kind="off"></i>Day off</li><li><i data-kind="recce"></i>Recce</li><li>Day 7 of 24</li></ul>
</div></div>
<div style="display:grid;gap:20px;align-content:start">
<div class="kw-date"><span class="kw-label">Rehearsal</span><button class="kw-date__field" type="button" aria-haspopup="dialog" aria-expanded="false" aria-label="Shoot date, Thu 12 Nov 2026, Recce day"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="18" height="18" rx="2"/><path d="M16 2v4M8 2v4M3 10h18"/></svg><span>Thu 12 Nov 2026</span><span class="kw-date__day kw-date__day--recce">Recce day</span></button><span class="kw-hint">Before the shoot. Not a shooting day.</span></div>
<div class="kw-date"><span class="kw-label">Shoot date</span><button class="kw-date__field" type="button" aria-haspopup="dialog" aria-expanded="false" aria-invalid="true" aria-label="Shoot date, Sun 22 Nov 2026, Day off"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="18" height="18" rx="2"/><path d="M16 2v4M8 2v4M3 10h18"/></svg><span>Sun 22 Nov 2026</span><span class="kw-date__day kw-date__day--off">Day off</span></button><span class="kw-error" role="alert"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="M12 8v4M12 16h.01"/></svg>Sun 22 Nov is a day off. Choose a shooting day, or add it to the schedule first.</span></div>
</div>
</div>
```

## Accessibility

### Keyboard (inside the month)
| Key | Does |
|---|---|
| Arrow keys | Move one day or one week. Crossing a month edge turns the month. |
| Home / End | First and last day of the week. |
| Page Up / Page Down | Previous and next month (Shift: year). |
| Enter / Space | Choose the day, close, return focus to the field. |
| Escape | Close without changing; focus returns to the field. |

### Roles and names
- The field is a button with `aria-haspopup="dialog"` and `aria-expanded`; its name includes the date and the tag.
- The month is a `role="grid"` table named *November 2026*; column heads carry the full weekday in `abbr`.
- Every day button has a full name: *Monday 23 November, shoot day 7 of 24*; *Sunday 22 November, day off*; *Monday 16 November, shoot day 1 of 24, today*.
- Only the chosen day is in the Tab order (roving `tabindex`); the chosen day has `aria-pressed="true"`, today has `aria-current="date"`.
- The month title is a polite live region so turning the month is announced.
- Shoot, recce and off are told by the note (*D7*, *recce*, *off*) and the name, not by colour.

## For agents

### Rules

- **Must** number shooting days from the schedule (Day 7 of 24); never derive the number from the calendar.
- **Must** store an all-day date as a local calendar date (YYYY-MM-DD); never as UTC midnight.
- **Always** give every day button a full spoken name with its weekday, month and shoot status.
- **Never** use a bare `<input type="date">` for production dates.
- **Always** start the week on Monday and show the weekday in the field.
- **Must** let a person choose a day off for non-shoot events, and explain the fix when it is chosen for a shoot.

### AI readiness test

**Task:** Let the 1st AD move the Day 7 call sheet to a different date.

**Give the agent:** Date picker, Production calendar, Call sheet.

**Constraint:** The schedule has 24 shooting days from 16 Nov with Sundays off.

**A reliable answer:**
- Field shows weekday and Day N of 24
- Month marks shoot days with D-numbers, days off dashed
- A day off chosen for a shoot gives an error naming the fix
- Date stored as YYYY-MM-DD
- Grid keyboard map and full day names
