← Back to library
Playwrightformsbeginnerv1.20+

Fill a date input

Set a value on a native <input type='date'> using ISO format.

1test('sets a date on a date input', async ({ page }) => {
2  await page.goto('/booking');
3
4  const dateInput = page.locator('input[type="date"][name="check-in"]');
5
6  // Native date inputs require ISO 8601 format: YYYY-MM-DD
7  await dateInput.fill('2025-08-15');
8  await expect(dateInput).toHaveValue('2025-08-15');
9
10  await page.getByRole('button', { name: 'Continue' }).click();
11  await expect(page.getByText('Aug 15, 2025')).toBeVisible();
12});
#date#input#fill#ISO