HTML Guide for datetime
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>
The value used in the datetime attribute is not in a valid format.
The <time> HTML element represents a specific period in time. It may include the datetime attribute to translate dates into machine-readable format, allowing for better search engine results or custom features such as reminders.