Skip to main content

HTML Guide

Bad value “datetime” for attribute “type” on element “input”.

type="datetime" is obsolete; it was removed from HTML and is not valid in modern browsers or validators.

Explanation

The input element’s type attribute accepts specific keywords defined by the HTML Living Standard. The keyword datetime was dropped; use either:

  • type="datetime-local" for a local date and time without timezone.
  • type="date" or type="time" when collecting them separately.
  • type="text" with a pattern or a JS widget when timezone-aware datetime is required.

Relevant attributes that still apply include name, value, min, max, and step (e.g., seconds for datetime-local).

HTML examples

Example reproducing the error

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Invalid input type</title>
</head>
<body>
  <form>
    <label>
      Meeting:
      <input type="datetime" name="meeting">
    </label>
  </form>
</body>
</html>

Valid fix with datetime-local

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Valid input type</title>
</head>
<body>
  <form>
    <label>
      Meeting:
      <input type="datetime-local" name="meeting" step="60">
    </label>
  </form>
</body>
</html>

Learn more:

Related W3C validator issues