# Date fields that don't say which format to type

Source: https://easeweb.dev/learn/date-format
Topics: Custom inputs > Dates can be typed in a format the field states, and the calendar works with a keyboard (WCAG 2.1.1, 4.1.2, 3.3.2)
The fix: Say which order the date is read in before it is typed. Either write the format into the label, or put it with an example in a hint tied to the field with aria-describedby, or ask for the day, month and year in separate labelled boxes, or use a native date input, or read the date in more than one form, state the order for figures, and say back in words the date that was read.
Test with: screen reader, keyboard, zoom
References: https://www.w3.org/WAI/WCAG22/Understanding/labels-or-instructions.html https://www.w3.org/WAI/WCAG22/Techniques/general/G89 https://www.w3.org/WAI/WCAG22/Techniques/aria/ARIA1 https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/date https://design-system.service.gov.uk/components/date-input/ https://designsystem.digital.gov/components/date-picker/

This is a recreated teaching example, not a finding about a named client. The code is a starting pattern: test it in your own product. No completed assistive-technology test is claimed here.

## What happens

A shop's checkout asks for a delivery date, in a text field labelled "Delivery date", with nothing under it. The field came with a date library, left at its default, and the shop's script reads every date as month, day, year. Someone who writes the day first, as most of Europe does, wants Thursday 12 November and types 12/11/2026. The script takes 12 as the month and 11 as the day, and the order goes through for Friday 11 December, a month late. Both readings are real dates, so there is no error and no warning; the only sign is the date in the order summary, if the person reads it closely.

Someone else writes the year first, as the ISO format and much of East Asia do, and types 2026/11/12. The script can't read it, and only now says how it wanted the date: "Enter the date as MM/DD/YYYY." A third person types 12 Nov 2026 and gets the same message. Each of them learns the format by failing first, and the person whose date was misread never learns it at all.

## Why it fails

Success Criterion 3.3.2 Labels or Instructions asks for labels or instructions when content needs input from the person, and its Understanding document says these may give the format the data must be in. One of its examples is a single date field with text that says the expected format. Technique G89 does this for a date field in its label: "Date (dd-mm-yyyy)". The test it gives is short: find each field that takes data only in a given format, and check that the field says what that format is.

A date field that takes figures is such a field. Different countries write the day, the month and the year in different orders, and when the day and the month are both 12 or under, 12/11/2026 is a real date in either order. The browser can't help: a text input takes any text, and what the text means is decided by the page's script, here a line that splits it on the slashes and takes the first number as the month. "Delivery date" names the field, but nothing on the page says which order that script reads, and the only place the format appears is the error, after a try has already failed.

## Who is affected

Most of the world writes the day first, the United States writes the month first, and the ISO standard and much of East Asia write the year first, so any numeric date with both the day and the month at 12 or under means two different days to two groups of people. A shop that sells across borders has all of them typing into one field.

## What automation and AI miss

A scanner such as axe finds a text field with a label and passes it: no rule can tell what order a script reads, or whether a label says enough about the format. The misread date is a valid date, so the shop's own checks pass it too. The audit raises a review lead for a text field whose label, name or autocomplete says it takes a date when no format appears in its label, its description or the text beside it, and says when the only format is a placeholder. A person still has to read the field and type a date to know what it does. Date picker libraries make the mistake easy: jQuery UI's datepicker reads `mm/dd/yy` by default, bootstrap-datepicker `mm/dd/yyyy` and react-datepicker `MM/dd/yyyy`, and none of them writes the format on the page unless the developer does. Date picker issue trackers and forums, for Angular Material and Vue date pickers among others, hold reports of typed dates with the day and month swapped. AI assistants asked for a date field can keep the library's default and leave the label as it is, since nothing in the code looks wrong.

## Before: a text field that reads month first and says nothing

```html
<form id="checkout">
  <label for="delivery">Delivery date</label>
  <input id="delivery" name="delivery" type="text" aria-describedby="delivery-error">
  <p id="delivery-error" class="error"></p>
  <button type="submit">Continue</button>
</form>
```

```js
const form = document.getElementById('checkout');
const field = document.getElementById('delivery');
const error = document.getElementById('delivery-error');

// The date library's default: every date is read month first.
function readDate(text) {
  const parts = text.trim().match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);
  if (!parts) return null;
  const [, month, day, year] = parts.map(Number);
  const date = new Date(year, month - 1, day);
  return date.getMonth() === month - 1 && date.getDate() === day ? date : null;
}

form.addEventListener('submit', (event) => {
  const date = readDate(field.value);
  error.textContent = date ? '' : 'Enter the date as MM/DD/YYYY.';
  if (!date) event.preventDefault();
});
```

- The label says "Delivery date" and nothing about the order, and nothing else on the page does either.
- The script reads 12/11/2026 as 11 December, and since that is a real date, nothing says it read anything other than what was meant.
- 2026/11/12 and 12 Nov 2026 are refused, and the format appears only then, in the error.

## After: the format in the label

```html
<form id="checkout">
  <label for="delivery">Delivery date (month/day/year)</label>
  <input id="delivery" name="delivery" type="text" aria-describedby="delivery-error">
  <p id="delivery-error" class="error"></p>
  <button type="submit">Continue</button>
</form>
```

```js
const form = document.getElementById('checkout');
const field = document.getElementById('delivery');
const error = document.getElementById('delivery-error');

// The date library's default: every date is read month first.
function readDate(text) {
  const parts = text.trim().match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);
  if (!parts) return null;
  const [, month, day, year] = parts.map(Number);
  const date = new Date(year, month - 1, day);
  return date.getMonth() === month - 1 && date.getDate() === day ? date : null;
}

form.addEventListener('submit', (event) => {
  const date = readDate(field.value);
  error.textContent = date ? '' : 'Enter the date as MM/DD/YYYY.';
  if (!date) event.preventDefault();
});
```

1. Add the order to the label, in words: "(month/day/year)". It is on screen before anything is typed, and a screen reader reads it as part of the field's name every time it reaches the field.
2. Leave the script as it is: it already reads the order the label now states.

This fixes the Before and passes 3.3.2, as G89 does. Words read better aloud than letters, so write "month/day/year" rather than "MM/DD/YYYY"; and keep the format short, since it is part of the name a voice control user says to reach the field.

## After: a hint with an example, tied to the field

```html
<form id="checkout">
  <label for="delivery">Delivery date</label>
  <p id="delivery-hint">Month, day, year, for example 03/27/2027</p>
  <input id="delivery" name="delivery" type="text" aria-describedby="delivery-hint delivery-error">
  <p id="delivery-error" class="error"></p>
  <button type="submit">Continue</button>
</form>
```

```js
const form = document.getElementById('checkout');
const field = document.getElementById('delivery');
const error = document.getElementById('delivery-error');

// The date library's default: every date is read month first.
function readDate(text) {
  const parts = text.trim().match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);
  if (!parts) return null;
  const [, month, day, year] = parts.map(Number);
  const date = new Date(year, month - 1, day);
  return date.getMonth() === month - 1 && date.getDate() === day ? date : null;
}

form.addEventListener('submit', (event) => {
  const date = readDate(field.value);
  error.textContent = date ? '' : 'Enter the date as MM/DD/YYYY.';
  if (!date) event.preventDefault();
});
```

1. Put a line under the label that gives the order and an example whose day is over 12, such as 03/27/2027, so the example itself can only be read one way.
2. Add its id to the field's `aria-describedby`, before the error's. A screen reader reads the hint after the label and the field's role, and the label stays short.

This fixes the Before and passes 3.3.2. It is the shape design systems use: the U.S. Web Design System puts "mm/dd/yyyy" in a hint under its date picker's label, for people who type the date instead of choosing it.

## After: separate day, month and year fields

```html
<form id="checkout">
  <fieldset aria-describedby="delivery-hint delivery-error">
    <legend>Delivery date</legend>
    <p id="delivery-hint">For example, 27 3 2027</p>
    <div>
      <label for="delivery-day">Day</label>
      <input id="delivery-day" name="delivery-day" type="text" inputmode="numeric">
    </div>
    <div>
      <label for="delivery-month">Month</label>
      <input id="delivery-month" name="delivery-month" type="text" inputmode="numeric">
    </div>
    <div>
      <label for="delivery-year">Year</label>
      <input id="delivery-year" name="delivery-year" type="text" inputmode="numeric">
    </div>
  </fieldset>
  <p id="delivery-error" class="error"></p>
  <button type="submit">Continue</button>
</form>
```

```js
const form = document.getElementById('checkout');
const error = document.getElementById('delivery-error');
const part = (name) => Number(form.elements[`delivery-${name}`].value.trim());

// Each part comes from its own labelled box, so no order has to be guessed.
function readDate() {
  const [day, month, year] = [part('day'), part('month'), part('year')];
  const date = new Date(year, month - 1, day);
  return year > 999 && date.getMonth() === month - 1 && date.getDate() === day ? date : null;
}

form.addEventListener('submit', (event) => {
  const date = readDate();
  error.textContent = date ? '' : 'Enter the day, month and year as numbers.';
  if (!date) event.preventDefault();
});
```

1. Ask for the day, the month and the year in three boxes, each with a visible label, so the order is on screen and nobody has to know it.
2. Put the boxes in a `fieldset` whose `legend` is the date's label, so a screen reader reads "Delivery date" as it enters the set, and tie the example and the error to the set with `aria-describedby`.
3. Give each box `inputmode="numeric"`, so phones show a number keypad, and read each part from its own box.

This fixes the Before and passes 3.3.2, and it is the GOV.UK date input. Every box needs its own name for 1.3.1 and 4.1.2 as well; [split date and phone fields with no name for each box](/learn/split-fields) covers that failure.

## After: a native date input

```html
<form id="checkout">
  <label for="delivery">Delivery date</label>
  <input id="delivery" name="delivery" type="date" aria-describedby="delivery-error">
  <p id="delivery-error" class="error"></p>
  <button type="submit">Continue</button>
</form>
```

```js
const form = document.getElementById('checkout');
const field = document.getElementById('delivery');
const error = document.getElementById('delivery-error');

// The browser sends the date as 2026-11-12, whatever order it shows on screen.
function readDate(text) {
  const parts = text.match(/^(\d{4})-(\d{2})-(\d{2})$/);
  if (!parts) return null;
  const [, year, month, day] = parts.map(Number);
  return new Date(year, month - 1, day);
}

form.addEventListener('submit', (event) => {
  const date = readDate(field.value);
  error.textContent = date ? '' : 'Enter the delivery date.';
  if (!date) event.preventDefault();
});
```

1. Give the field `type="date"`. The browser draws it as day, month and year parts in the order of its own language settings, and in most desktop browsers shows that order in the empty field, such as mm/dd/yyyy, so the format is stated before anything is typed. Each part takes only its own number, and on a phone a tap opens the system's date picker.
2. Read the value as year, month, day: the browser always sends 2026-11-12, whatever order it shows.

This fixes the Before and passes 3.3.2, as far as each browser's own control does. The order follows the browser, not the page, so don't write a format of your own beside a native date field, since it may not match; and its calendar is a different matter, covered in [date pickers that can't be typed in or used by keyboard](/learn/date-picker).

## After: a field that reads several forms and says what it read

```html
<form id="checkout">
  <label for="delivery">Delivery date</label>
  <p id="delivery-hint">Month, day, year, for example 03/27/2027, or start with the year: 2027/03/27</p>
  <input id="delivery" name="delivery" type="text" aria-describedby="delivery-hint delivery-read delivery-error">
  <p id="delivery-read" role="status"></p>
  <p id="delivery-error" class="error"></p>
  <button type="submit">Continue</button>
</form>
```

```js
const form = document.getElementById('checkout');
const field = document.getElementById('delivery');
const read = document.getElementById('delivery-read');
const error = document.getElementById('delivery-error');
const MONTHS = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];

// Figures month first or year first, split by any of / - . or a space, or the month as a word.
function readDate(text) {
  const parts = text.trim().toLowerCase().split(/[\s,./-]+/);
  if (parts.length !== 3) return null;
  let day, month, year;
  const named = parts.findIndex((part) => MONTHS.includes(part.slice(0, 3)));
  if (named >= 0) {
    month = MONTHS.indexOf(parts[named].slice(0, 3)) + 1;
    [day, year] = parts.filter((_, i) => i !== named).map(Number);
  } else if (parts[0].length === 4) [year, month, day] = parts.map(Number);
  else [month, day, year] = parts.map(Number);
  const date = new Date(year, month - 1, day);
  return year > 999 && date.getMonth() === month - 1 && date.getDate() === day ? date : null;
}

// Once the field is left, say back in words the date that was read.
field.addEventListener('change', () => {
  const date = readDate(field.value);
  read.textContent = date ? date.toLocaleDateString('en-US', { dateStyle: 'full' }) : '';
});

form.addEventListener('submit', (event) => {
  const date = readDate(field.value);
  error.textContent = date ? '' : 'Enter the date as MM/DD/YYYY.';
  if (!date) event.preventDefault();
});
```

1. Read the forms people use that can only mean one day: the year first, such as 2026/11/12, and the month as a word, such as 12 Nov 2026 or November 12, 2026, with any separator.
2. Keep one stated order for figures that could be read either way, and give it in a hint with an example, as in the hint fix, naming the year-first form too.
3. Once the field is left, write the date that was read in words under it, such as "Thursday, November 12, 2026", in an element with `role="status"`, so a screen reader can read it out, and add its id to the field's `aria-describedby`, so it is read again when the field is reached.

This fixes the Before and passes 3.3.2: the order is stated before the date is typed, and a date typed in another order shows up at once as the wrong day, beside the field, where it can be put right before the order is placed.

## Which option to use

All five pass 3.3.2. The format in the label is the smallest change, one line of markup, and it is read every time the field is reached; it makes the name longer. A hint with an example is nearly as small, and the example settles the order for anyone unsure what "month, day, year" means. Separate boxes take the order off the person entirely and suit a date people know without a calendar, such as a date of birth; they take more space and their own validation. A native date input needs no format text and no parsing, if the browser's look for the field and its calendar is acceptable. Reading several forms costs the most code and suits a shop whose customers come from many countries; the date said back in words is worth adding to any of the other typed fields as well.

## Implementation decisions

Give the format in text that stays on screen. A placeholder such as DD/MM/YYYY is gone once the first figure is typed, and is often too faint to read; see [form fields with missing or mismatched labels](/learn/form-labels). An example works best when its day is over 12 and it is a date that makes sense for the question, as GOV.UK advises.

Choose the order for your readers. A shop that sells mostly in one country can state that country's order; a shop that sells across borders is the one that most needs the stated order, or the read-back, or separate boxes. Whatever the order, keep the label, the hint, the error message and the script in step: a hint that says day first above a script that reads month first is worse than no hint.

Read forgivingly within the stated order: a date with or without leading zeros, and with dashes, dots or spaces instead of slashes, can only mean what it says. GOV.UK's date input also accepts month names typed in its boxes. See [convert what people type instead of rejecting it](/learn/rules-of-thumb#convert-not-reject). A date mask that fills in slashes as people type is a different failure, covered in [input masks that change a typed or pasted number](/learn/input-masks).

When the date can't be read, the error should say what to do, as the ones above do. Where errors go and how they are announced is covered in [form errors that don't say how to fix them](/learn/accessible-form-errors).

## Verify the fix

1. Before typing anything, look at the field, the text above and below it, and its markup: the order is in the label, or in visible text the field's `aria-describedby` points at, or each part has its own label, or the field is `type="date"`; and the format isn't only in a placeholder or a `title`.
2. Type 12/11/2026 day first, 2026/11/12 and 12 Nov 2026, and press Continue each time: each date is read as meant, or said back in words beside the field before the order is placed, or refused with a message saying what to type, and none becomes another day without a word.
3. With a screen reader, Tab to the field or to each of its boxes: you hear the label with the format, the hint or the box's own name, and, in the read-back fix, the date that was read once you leave the field.
4. At 200% zoom and at a phone's width, check the format stays next to the field and in view while you type.

Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat after the shared date field component changes.

## Limits

This guide is about saying how to write a single typed date. Choosing a date from a calendar with a keyboard, and hearing its days with a screen reader, is in [date pickers that can't be typed in or used by keyboard](/learn/date-picker). It doesn't cover date ranges, times and time zones, or calendars other than the Gregorian one. The snippets leave out checking that the shop delivers on that day. Test the complete journey, with your real dates and the orders your customers write them in, in the browsers and assistive technology you support.

## What screen readers do (tested by hand by EaseWeb)

`aria-describedby`: Gives an element a description, such as a hint or an error, from text elsewhere on the page.

| Screen reader | Browser and system | Tab to it | Down Arrow |
| --- | --- | --- | --- |
| JAWS | Chrome, Windows 11 | Not tested | Not tested |
| NVDA | Chrome, Windows 11 | Not tested | Not tested |
| JAWS | Edge, Windows 11 | Not tested | Not tested |
| NVDA | Firefox, Windows 11 | Not tested | Not tested |
| NVDA | Edge, Windows 11 | Not tested | Not tested |
| JAWS | Firefox, Windows 11 | Not tested | Not tested |
| VoiceOver | Safari, macOS | Not tested | Not tested |
| VoiceOver | Safari, iOS | Not tested | Not tested |
| TalkBack | Chrome, Android | Not tested | Not tested |

`role="status"`: A polite live region: its changes wait until the screen reader has finished what it is saying.

| Screen reader | Browser and system | Down Arrow | Say all |
| --- | --- | --- | --- |
| JAWS | Chrome, Windows 11 | Not tested | Not tested |
| NVDA | Chrome, Windows 11 | Not tested | Not tested |
| JAWS | Edge, Windows 11 | Not tested | Not tested |
| NVDA | Firefox, Windows 11 | Not tested | Not tested |
| NVDA | Edge, Windows 11 | Not tested | Not tested |
| JAWS | Firefox, Windows 11 | Not tested | Not tested |
| VoiceOver | Safari, macOS | Not tested | Not tested |
| VoiceOver | Safari, iOS | Not tested | Not tested |
| TalkBack | Chrome, Android | Not tested | Not tested |

https://easeweb.dev/learn/screen-reader-support

---

Get this guide in your coding agent: MCP https://easeweb.dev/mcp (setup at https://easeweb.dev/services/developers)
