elements / date & time

Advanced element

Date & Time Inputs

Native date pickers, time selectors, combined datetime-local widgets, and interactive date-range calculators.

Date picker

#input-date
id
input-date
format
YYYY-MM-DD
expected
Opens native browser calendar; value formatted as ISO 8601 YYYY-MM-DD.
Code snippets
Python (Selenium)
el = driver.find_element(By.ID, "input-date")
el.send_keys("2026-12-25")
assert el.get_attribute("value") == "2026-12-25"
TypeScript (Playwright)
await page.fill('#input-date', '2026-12-25');
expect(await page.inputValue('#input-date')).toBe('2026-12-25');

Time picker

#input-time
id
input-time
format
HH:MM (24-hour)
expected
Native time selector; value represented in 24-hour HH:MM format.
Code snippets
Python (Selenium)
el = driver.find_element(By.ID, "input-time")
el.send_keys("14:30")
assert el.get_attribute("value") == "14:30"
TypeScript (Playwright)
await page.fill('#input-time', '14:30');
expect(await page.inputValue('#input-time')).toBe('14:30');

Datetime-local

#input-datetime
id
input-datetime
format
YYYY-MM-DDTHH:MM
expected
Combined date + time selector; separated with 'T'.
Code snippets
Python (Selenium)
el = driver.find_element(By.ID, "input-datetime")
el.send_keys("2026-10-15T09:00")
assert el.get_attribute("value") == "2026-10-15T09:00"
TypeScript (Playwright)
await page.fill('#input-datetime', '2026-10-15T09:00');
expect(await page.inputValue('#input-datetime')).toBe('2026-10-15T09:00');

Date range calculation

#input-date-from
Duration: —
ids
input-date-from, input-date-to
output
#date-range-out
expected
Selecting both dates updates the days duration automatically.
Code snippets
Python (Selenium)
driver.find_element(By.ID, "input-date-from").send_keys("2026-05-01")
driver.find_element(By.ID, "input-date-to").send_keys("2026-05-08")
out = driver.find_element(By.ID, "date-range-out")
assert "7 days" in out.text
TypeScript (Playwright)
await page.fill('#input-date-from', '2026-05-01');
await page.fill('#input-date-to', '2026-05-08');
expect(await page.textContent('#date-range-out')).toContain('7 days');