원클릭으로
date-input
Use when implementing enter dates in a structured text format.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Use when implementing enter dates in a structured text format.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Use when implementing help users understand their current location.
Use when implementing expand and collapse content sections.
Use when implementing user account configuration and preferences.
Use when implementing social activity and updates stream.
Use when implementing conversational AI chat interfaces.
Use when implementing handling AI-specific errors.
| name | date-input |
| description | Use when implementing enter dates in a structured text format. |
| metadata | {"id":"date-input","category":"forms","pattern":"Date Input","source":"uxpatterns.dev","url":"https://uxpatterns.dev/patterns/forms/date-input","sourcePath":"apps/web/content/patterns/forms/date-input.mdx"} |
Enter dates in a structured text format
A Date Input is a form field specifically designed for entering date values. It encompasses two primary implementation approaches: the native <input type="date"> control (which renders the browser's built-in date picker), and structured text inputs using masked or segmented fields (e.g., MM/DD/YYYY format with auto-advance between day, month, and year segments).
Date Input is distinct from a Date Picker in that it focuses on direct keyboard entry of a date value rather than calendar-based visual selection. It is the preferred approach for entering known dates (birth dates, expiry dates) where a calendar view adds unnecessary complexity.
references/pattern.md, then choose the smallest viable variation.| Key | Action |
|---|---|
Tab | Moves focus to the date input or next segment |
Shift + Tab | Moves focus to the previous input or segment |
0–9 | Enters numeric digits in native input or current segment |
Arrow Up / Down | Increments / decrements date value in native date input |
Arrow Left / Right | Moves between date parts in native input; navigates segments manually |
Backspace | Clears current segment value; moves to previous segment if empty |
Delete | Clears current segment without moving focus |
The Problem: Providing an input without indicating expected format causes user errors, especially in international contexts.
<!-- Bad: No format hint -->
<label for="dob">Date of birth</label>
<input type="text" id="dob" placeholder="Enter date" />
How to Fix It? Always specify format in label or helper text.
<!-- Good -->
<label for="dob">Date of birth (MM/DD/YYYY)</label>
<input type="text" id="dob" inputmode="numeric" placeholder="MM/DD/YYYY" aria-describedby="dob-help" />
<p id="dob-help">Example: 01/15/1990</p>
The Problem: Checking only that day ≤ 31, month ≤ 12, and year is 4 digits misses invalid dates like February 30 or April 31.
How to Fix It? Always validate the assembled date as a whole.
function validateDate(month, day, year) {
const date = new Date(year, month - 1, day);
return (
date.getFullYear() === Number(year) &&
date.getMonth() === Number(month) - 1 &&
date.getDate() === Number(day)
);
}
The Problem:
<input type="date"> always stores values as YYYY-MM-DD regardless of display locale, but developers often try to parse the displayed format instead.
How to Fix It? Always read from input.value (ISO format) or input.valueAsDate.
// Good: read ISO value, format for display separately
const dateInput = document.getElementById('my-date');
const isoValue = dateInput.value; // "2026-03-12"
const dateObject = dateInput.valueAsDate; // Date object
For full implementation detail, examples, and testing notes, see references/pattern.md.
Pattern page: https://uxpatterns.dev/patterns/forms/date-input