Prejsť na hlavný obsah
← 📄 HTML & the platform·Modul A3 · Lekcia 4
ÚlohaBuild an event form: <input name='date' type='date' min='2026-01-01'> and <input name='time' type='time'>.

Vstupy dátumu/času

75 XP7 min
Teória

Native pickers — no jQuery datepicker needed

<input type="date" name="dob" />                  <!-- 2026-05-20 -->
<input type="time" name="alarm" />                <!-- 14:30 -->
<input type="datetime-local" name="meeting" />    <!-- 2026-05-20T14:30 -->
<input type="month" name="month" />               <!-- 2026-05 -->
<input type="week" name="week" />                 <!-- 2026-W21 -->

Every modern browser ships a calendar/clock picker. The user types or picks; the value submitted is ISO 8601.

ISO 8601 is the only format

Don't put format hints in placeholders like "MM/DD/YYYY". The browser localizes display to the user's locale automatically — they see "May 20, 2026" in en-US, "20 Mai 2026" in de-DE, "20/05/2026" in en-GB. The value that gets posted is always YYYY-MM-DD.

min and max work

<input type="date" name="dob" max="2026-05-20" />   <!-- can't pick a future date -->
<input type="date" name="appt" min="2026-06-01" max="2026-12-31" />

datetime-local has no timezone

The submitted value is 2026-05-20T14:30 with no Z or offset. The browser sends it in the user's local time, and your backend must store the user's timezone separately (or assume UTC). Use type="datetime-local" for "wall clock" times (meetings, alarms) and a server-side picker for absolute UTC instants.

🔒

Zaregistruj sa a začni programovať

Teória je otvorená pre každého. Editor, živý náhľad a kontrola sa odomknú so 7-dňovou bezplatnou skúškou — karta potrebná, zruš kedykoľvek.

Registrácia — bezplatná skúška →

Prvých 10 lekcií v každej trase je zdarma. Karta nie je potrebná.

← PredchádzajúcaĎalšia lekcia →

Jeden tip k Pythonu alebo webu denne — e-mailom

Krátke, ručne písané, žiadny spam. Odhlásiť jedným klikom.