HTML Guide
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.
Learn more:
Related W3C validator issues
The boolean required attribute can only be used with certain types of inputs. Check the input type is one of the allowed.
The required attribute, if present, indicates that the user must specify a value for the input before the owning form can be submitted.
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 <time> HTML element represents a specific period in time, which can be taken from the datetime attribute or from the text contents of the element.
In both cases, the time or datetime must be in a valid format, for example:
- a valid year string
-
2011
- a valid month string
-
2011-11
- a valid date string
-
2011-11-18
- a valid yearless date string
-
11-18
- a valid week string
-
2011-W47
- a valid time string
-
14:54
14:54:39
14:54:39.929
- a valid local date and time string
-
2011-11-18T14:54:39.929
2011-11-18 14:54:39.929
- a valid global date and time string
-
2011-11-18T14:54:39.929Z
2011-11-18T14:54:39.929-0400
2011-11-18T14:54:39.929-04:00
2011-11-18 14:54:39.929Z
2011-11-18 14:54:39.929-0400
2011-11-18 14:54:39.929-04:00
- a valid duration string
-
PT4H18M3S
For example:
<p>
The event will take place on <time datetime="2025-03-20T13:00">March 20, 2025</time>.
</p>