splitforms.com

HTML · FORM CONTROL

HTML input type=date: value format, default today and min/max

Last reviewed

<input type="date"> shows the browser's native date picker and always submits the value as yyyy-mm-dd (ISO 8601), whatever display format the user sees. Its siblings work the same way: time sends HH:mm, datetime-local sends yyyy-mm-ddTHH:mm, month sends yyyy-mm and week sends yyyy-Www. None of them includes a time zone.

  • 500 free total
  • No backend
  • Copy-paste ready
Live demo · runs in your browser, nothing is sent
  • ""
  • ""
  • ""
  • ""
  • ""

<input type="date">

input.value
""
valueAsDate
null
valueAsNumber
NaN
validity
valid
input.value = new Date(Date.now() - new Date().getTimezoneOffset() * 6e4).toISOString().slice(0, 10);

Checking your time zone…

Copy-paste code

HTML Date Input code you can paste today.

Replace YOUR_ACCESS_KEY with a key from your free splitforms dashboard. The form posts to one endpoint — submissions land in your inbox and dashboard with spam filtering built in.

Get free access key
input-type-date.html
<form action="https://splitforms.com/api/submit" method="POST">
  <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY">

  <label for="name">Name</label>
  <input type="text" id="name" name="name" autocomplete="name" required>

  <label for="email">Email</label>
  <input type="email" id="email" name="email" autocomplete="email" required>

  <!-- Submits yyyy-mm-dd, e.g. 2026-10-02 -->
  <label for="booking_date">Preferred date</label>
  <input type="date" id="booking_date" name="booking_date" required>

  <!-- Submits HH:mm: 15-minute slots from 09:00 to 17:00 -->
  <label for="booking_time">Preferred time</label>
  <input type="time" id="booking_time" name="booking_time"
         min="09:00" max="17:00" step="900" required>

  <!-- Submits yyyy-mm-ddTHH:mm, with no time zone -->
  <label for="callback_at">Or request a call back at</label>
  <input type="datetime-local" id="callback_at" name="callback_at">

  <!-- Honeypot: hidden from people, bots fill it in -->
  <input type="checkbox" name="botcheck" style="display:none" tabindex="-1" autocomplete="off">

  <button type="submit">Request booking</button>
</form>

Value formats

What format does each date and time input submit?

Each type submits one fixed string format from the HTML Standard, the same in every browser and locale; only the on-screen display follows the user's locale. A blank or half-typed field submits an empty string. The examples use 2 October 2026 at 14:30.

What format does each date and time input submit?
typeSubmitted valueExamplevalueAsNumbervalueAsDate
dateyyyy-mm-dd2026-10-02Milliseconds from 1970-01-01 to that day's UTC midnight: 1790899200000That day at UTC midnight
timeHH:mm, plus :ss or :ss.sss when seconds are set14:30Milliseconds since midnight: 522000001970-01-01 at that time, in UTC
datetime-localyyyy-mm-ddTHH:mm, plus :ss when the seconds are not zero2026-10-02T14:30Milliseconds from 1970-01-01T00:00, reading the value as if it were UTC: 1790951400000null: it does not apply to this type
monthyyyy-mm2026-10Months since January 1970, not milliseconds: 681The 1st of the month at UTC midnight
weekyyyy-Www, an ISO 8601 week that starts on Monday2026-W40Milliseconds to 00:00 UTC on the week's Monday: 1790553600000That Monday at UTC midnight

Every valueAsDate is a UTC moment, so format it with timeZone: "UTC"; otherwise 2026-10-02 displays as 1 October anywhere west of UTC. A time value has no date and a datetime-local value has no time zone, so send the visitor's zone with it when the exact moment matters.

Sources: WHATWG HTML Standard: date and time microsyntaxes · WHATWG: date state · WHATWG: time state · WHATWG: local date and time state · WHATWG: month state · WHATWG: week state · MDN: valueAsNumber

Browser support

Do date inputs work in Safari, Firefox and Chrome?

date, time and datetime-local are Baseline: MDN lists them as working across current browsers, Safari and Firefox included. month and week are not, because desktop Firefox and Safari render them as plain text boxes, so give those two a fallback.

Do date inputs work in Safari, Firefox and Chrome?
typeSupport (MDN)Where it is not supported
dateBaseline widely available; in every major browser since April 2021Old browsers such as Internet Explorer show a text box
timeBaseline widely available; in every major browser since April 2021Old browsers such as Internet Explorer show a text box
datetime-localBaseline widely available; in every major browser since October 2021Old browsers such as Internet Explorer show a text box. Safari's picker covers the date only; the time is typed
monthLimited availability: no picker in desktop Firefox or SafariA text box. Add pattern and placeholder so typed values still match yyyy-mm
weekLimited availability: no picker in desktop Firefox or SafariA text box. Add pattern and placeholder so typed values still match yyyy-Www

Support levels as MDN showed them on 2 October 2026. The live demo above reads the real elements, so in a browser without month or week support it says so.

What gets submitted

What does the server receive from a date input?

The request carries the same strings as input.value: no Date object, no locale formatting and no time zone. splitforms saves them to your dashboard exactly as sent, so the booking form above arrives like this. Get a free access key and point the form at your own inbox.

What does the server receive from a date input?
FieldRequest body (URL-encoded)Saved in splitforms as
booking_date (date)booking_date=2026-10-022026-10-02
booking_time (time)booking_time=14%3A3014:30
callback_at (datetime-local)callback_at=2026-10-02T14%3A302026-10-02T14:30
callback_at left blankcallback_at=An empty value
Any field with disabledNothing: disabled controls are skippedNot present

URL encoding turns : into %3A; the dashboard shows the decoded value. Checked against the splitforms submit code on 2 October 2026.

Sources: WHATWG HTML Standard: constructing the entry list · URL Standard: application/x-www-form-urlencoded

Attributes · <input type=date>

Which HTML Date Input attributes matter?

These attributes decide how the <input type=date> behaves and what actually gets emailed to your inbox when someone submits.

HTML Date Input attributes and what each one does
AttributeWhat it doesDocs
valueThe starting value, written in the submitted format: value="2026-10-02". Anything else, such as 10/02/2026, is thrown away and the field starts empty.MDN
minThe earliest value allowed, in the same format. Earlier values fail as rangeUnderflow and block submit. min is also the base that step counts from.MDN
maxThe latest value allowed; later ones fail as rangeOverflow. On time, a max earlier than min (22:00 to 06:00) is a valid overnight range.MDN
stepCounted in days for date, seconds for time and datetime-local (default 60), months for month and weeks for week. step="7" with a Monday as min accepts Mondays only.MDN
requiredBlocks submit while the field is empty. A half-typed date has an empty value, so it is blocked too.MDN
listThe id of a <datalist> of suggested values, such as your usual appointment times. How browsers show the suggestions varies, and MDN lists no Firefox support for a datalist on date or time inputs.MDN

Common mistakes

HTML Date Input not working? Here's why.

Most broken forms come down to a few small mistakes with the <input type=date>. Check these before you ship, then forward every submission to Slack or a webhook.

  1. There is no placeholder

    placeholder does not apply to date and time inputs, so the browser ignores it and shows its own format hint, such as mm/dd/yyyy. Put any hint in the <label> or a line of help text instead.

  2. toISOString() is a day off

    new Date().toISOString().slice(0, 10) and input.valueAsDate = new Date() both use the UTC date, which is yesterday or tomorrow for part of every day outside UTC. Build the value from the local date, as in the default-to-today recipe below.

  3. The server gets a string, not a date

    The request carries 2026-10-02 or 2026-10-02T14:30 with no time zone. Treat it as a calendar date, not a UTC instant, and check it again on the server: min, max and required only run in the browser.

  4. month and week can turn into text boxes

    Desktop Firefox and Safari don't support type="month" or type="week" and render a plain text box. Add a pattern so typed values still match the format.

Sources: WHATWG HTML Standard: date state · WHATWG HTML Standard: dates and times · MDN: <input type="date"> · MDN: Date and time formats used in HTML · MDN: Date.prototype.toISOString() · flatpickr options

value

How do I set input type=date to today by default?

HTML has no way to say "today" in the value attribute, so set it from JavaScript when the page loads. Use the local date: shift the clock by getTimezoneOffset() before calling toISOString(), or the field shows yesterday or tomorrow for part of every day outside UTC. valueAsDate = new Date() has the same UTC problem.

The same shifted string fills the other types: .slice(0, 16) for datetime-local, .slice(0, 7) for month and .slice(11, 16) for time.

default-today.html
<input type="date" id="booking_date" name="booking_date">

<script>
  // Local date as yyyy-mm-dd. Not new Date().toISOString(), which is UTC.
  const today = new Date(Date.now() - new Date().getTimezoneOffset() * 6e4)
    .toISOString()
    .slice(0, 10);

  document.getElementById("booking_date").value = today;
</script>

min

How do I disable past dates in a date picker?

Set min to today's local date and the browser rejects anything earlier, flagging it as rangeUnderflow and blocking submit. A max caps how far ahead people can book. Both must be yyyy-mm-dd strings, so compute them with the same local-date helper.

min and max are browser checks only. Anyone can post an old date straight to your endpoint, so reject it on the server too.

block-past-dates.html
<label for="booking_date">Preferred date</label>
<input type="date" id="booking_date" name="booking_date" required>

<script>
  // yyyy-mm-dd for a Date, in the visitor's time zone
  const ymd = (d) =>
    new Date(d.getTime() - d.getTimezoneOffset() * 6e4).toISOString().slice(0, 10);

  const now = new Date();
  const in90Days = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 90);

  const field = document.getElementById("booking_date");
  field.min = ymd(now);      // no past dates
  field.max = ymd(in90Days); // up to 90 days ahead
</script>

Intl.DateTimeFormat

Can I change the date format of input type=date?

No. The browser draws the field in the user's locale, so the same input shows 10/02/2026 in the US and 02/10/2026 in the UK, and HTML has no attribute to change it. The submitted value is 2026-10-02 either way. For a fixed format on screen, show it beside the field with Intl.DateTimeFormat, or use a text input with a date-picker library.

valueAsDate is midnight UTC, so format it with timeZone: "UTC". Without it, visitors west of UTC see the day before.

show-date-format.html
<label for="when">Date</label>
<input type="date" id="when" name="when">
<output for="when" id="when-text"></output>

<script>
  const when = document.getElementById("when");
  const fmt = new Intl.DateTimeFormat("en-GB", {
    dateStyle: "long",
    timeZone: "UTC", // valueAsDate is midnight UTC
  });

  when.addEventListener("input", () => {
    document.getElementById("when-text").textContent =
      when.valueAsDate ? fmt.format(when.valueAsDate) : "";
  });
</script>

datetime-local

How do I send the time zone with a datetime-local value?

datetime-local submits wall-clock time with no offset, so 2026-10-02T14:30 could be in any time zone. Add a hidden field filled from Intl.DateTimeFormat().resolvedOptions().timeZone, which returns an IANA name such as Europe/London, and the server can turn the pair into an exact moment.

datetime-with-zone.html
<label for="callback_at">Call me back at</label>
<input type="datetime-local" id="callback_at" name="callback_at">
<input type="hidden" id="time_zone" name="time_zone">

<script>
  document.getElementById("time_zone").value =
    Intl.DateTimeFormat().resolvedOptions().timeZone; // e.g. "Europe/London"
</script>

<!-- Arrives as: callback_at = 2026-10-02T14:30
                 time_zone   = Europe/London -->

showPicker()

How do I style the date picker icon?

In Chrome, Edge and other Chromium browsers the calendar icon is the non-standard ::-webkit-calendar-picker-indicator pseudo-element; browsers without it skip the rule. The popup calendar itself can't be styled, but color-scheme: dark asks the browser for its dark version. To open the picker from your own button, call input.showPicker(). MDN lists the method as Baseline since September 2022, but its compatibility table gives date inputs later support: Safari 17.4 on the Mac and none yet in Safari on iOS, so keep the field itself usable.

showPicker() only works from a user action such as a click, and on a date input it throws a SecurityError inside a cross-origin iframe.

date-picker-icon.html
<style>
  /* Chromium only: restyle the built-in calendar icon */
  input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
  }
  input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
  }
  /* Ask for the dark picker on a dark theme */
  .dark input[type="date"] { color-scheme: dark; }
</style>

<input type="date" id="when" name="when">
<button type="button" id="open-picker">Pick a date</button>

<script>
  document.getElementById("open-picker").addEventListener("click", () => {
    const input = document.getElementById("when");
    input.focus();
    try {
      input.showPicker(); // needs a click (user activation)
    } catch {
      // No showPicker() here: the field is focused for typing or tapping
    }
  });
</script>

flatpickr

Native date picker or a library like flatpickr?

Start with the native input: no JavaScript, an accessible picker people already know, and phones show their own date controls. Reach for a library when you need what HTML can't do: disable specific days (weekends, holidays, booked slots), pick a range in one field, or show one display format to everyone. flatpickr's altInput shows a readable date while the form still submits Y-m-d, the same yyyy-mm-dd string. On phones it uses the native picker unless you set options such as disable.

flatpickr.html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">
<script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>

<input type="text" id="when" name="booking_date">

<script>
  flatpickr("#when", {
    dateFormat: "Y-m-d", // submitted: 2026-10-02
    altInput: true,      // shown: 2 October 2026
    altFormat: "j F Y",
    minDate: "today",
    // No weekends. Using disable keeps flatpickr's calendar on phones too.
    disable: [(date) => date.getDay() === 0 || date.getDay() === 6],
  });
</script>

pattern

How do I support type=month and type=week in Firefox and Safari?

Add pattern and placeholder to the month or week input. Browsers that support the type ignore both, because neither applies to it. Desktop Firefox and Safari render a text box instead, and there the pattern makes the browser reject anything that isn't yyyy-mm. To branch in JavaScript, check input.type: it reads "text" when the type isn't supported.

month-fallback.html
<label for="start_month">Start month (yyyy-mm)</label>
<input type="month" id="start_month" name="start_month"
       placeholder="yyyy-mm" pattern="[0-9]{4}-[0-9]{2}">

<script>
  const field = document.getElementById("start_month");
  if (field.type !== "month") {
    // Text box fallback: the pattern above still checks the format.
    field.title = "Use the format yyyy-mm, for example 2026-10";
  }
</script>

Copy-paste ready

The HTML Date Input example below is a complete, working form — paste it into any HTML page and it submits, no edits to the markup required.

No backend to build

Your html date input form posts to one endpoint. No server, PHP, or API route — accepted submissions are saved to your dashboard before owner notification email is attempted; delivery time and inbox placement depend on provider and recipient settings.

A form that really submits

Unlike a static reference snippet, this <input type=date> form actually sends data to a free splitforms backend, with spam filtering built in.

How it works

How to add HTML Date Input to any page.

Copy the html date input example, drop in your free access key, and paste it into any page — submissions start landing in your dashboard.

Copy the code

Copy the HTML Date Input example below.

Add your access key

Replace YOUR_ACCESS_KEY with a free splitforms key from the dashboard.

Paste into your site

Drop the form into any HTML page. Submissions arrive in your dashboard.

How SplitForms works

What happens after someone submits your form?

splitforms receives the submission, filters spam, saves it to your dashboard and emails you — then, on paid plans, sends it on to your webhooks and integrations. No backend infrastructure to build.

A SplitForms contact form submission launching straight to your inbox

Add your endpoint

Point your form to your unique SplitForms endpoint. That's it.

HTML form pointing at a SplitForms submit endpoint

Receive submissions

We instantly capture and organize every submission in your inbox.

Submissions inbox with searchable leads and status pills

Route anywhere

Send data to email, spreadsheets, CRMs, webhooks, and 7,000+ apps.

Generic integration tiles for email, sheets, chat, CRM, automate, and webhook

No credit card required. Set up in under 60 seconds.

Connect & automate

Where can submissions go besides email?

On paid plans, submissions can also go to Slack, Discord, Google Sheets, Notion, Airtable, Zapier or any signed webhook — and splitforms works on the platforms you build on, from WordPress and Shopify to Next.js. With Stripe connected, your forms can take payments too.

Connect your SplitForms form to Slack, Google Sheets, Mailchimp, Zapier and more
NewTake payments on your formsDeposits, bookings, order forms — submitters check out through Stripe and the money goes straight to your Stripe account. Included on every paid plan.See plans →

Setup guides for the stacks you use

Questions

HTML Date Input questions, answered.

View all FAQs
What format does input type=date use?

It always submits yyyy-mm-dd, such as 2026-10-02, the ISO 8601 calendar date format. The date shown on screen follows the user's locale (10/02/2026 in the US, 02/10/2026 in the UK), but input.value and the submitted value never change format.

How do I set input type=date to today's date by default?

Set it from JavaScript with the local date: input.value = new Date(Date.now() - new Date().getTimezoneOffset() * 6e4).toISOString().slice(0, 10). Don't use new Date().toISOString().slice(0, 10) on its own: that is the UTC date, which is a day off for part of every day outside UTC.

How do I change the date format of input type=date to dd/mm/yyyy?

You can't. The browser picks the display format from the user's locale and HTML has no attribute to override it. Show a formatted copy next to the field with Intl.DateTimeFormat, or use a text input with a library such as flatpickr. The submitted value is yyyy-mm-dd either way.

How do I disable past dates in an HTML date input?

Set the min attribute to today's date as yyyy-mm-dd, worked out in the visitor's local time zone. Earlier dates then fail validation as rangeUnderflow and block submit. Check the date on the server as well, because min only runs in the browser.

Why does my date show one day earlier?

Something treated the date as midnight UTC. new Date("2026-10-02") and input.valueAsDate are both midnight UTC, so formatting them in a time zone west of UTC shows 1 October. Format with timeZone: "UTC", or build the Date from local parts with new Date(2026, 9, 2).

Can I use a placeholder on input type=date?

No. placeholder does not apply to date and time inputs, and browsers show their own format hint instead. Put the hint in the label or in help text below the field.

What is the difference between datetime-local and separate date and time inputs?

datetime-local is one control that submits one value, such as 2026-10-02T14:30. Separate date and time inputs submit two values, 2026-10-02 and 14:30, and each can have its own min, max and step, such as 15-minute slots within opening hours. Neither includes a time zone.

Do date inputs work in Safari and Firefox?

Yes for date, time and datetime-local: MDN marks all three as Baseline, so they work in current Chrome, Edge, Firefox and Safari. month and week are not Baseline: desktop Firefox and Safari show a plain text box, so add a pattern as a fallback.

What does splitforms receive from a date field?

The exact string the browser sent, such as 2026-10-02 or 2026-10-02T14:30, saved as text in your splitforms dashboard. Point the form's action at https://splitforms.com/api/submit with your access key; the Free plan covers 500 submissions in total and includes spam filtering.

Simple pricing

How much does splitforms cost?

Free gives you 500 submissions for $0 — no card, no time limit. Pro is $5/month for 5,000 submissions a month, and Annual is $49/year for 15,000 a month with every Pro feature.

Free

$0— 500 submissions
 

No card, no time limit

Best for testing

For side projects and indie devs.

  • 500 free submissions
  • Unlimited forms
  • Email notifications included
  • Smart spam filtering
  • Submissions dashboard
  • Redirect after submit
  • MCP server included

Annual

$49/ year
About $4.08/mo, billed yearly
Best value

Every Pro feature with triple the volume — $0.27 per 1,000 at full use.

  • 15,000 submissions / mo
  • Unlimited forms
  • Everything in Pro
  • File uploads with 5 GB storage
  • 3 team seats
  • Priority email support

No credit card required on Free • Cancel anytime • Full pricing and FAQ