Reputation: 336
I have a datetime-local input.
I wish I had the ability to mandatory specify a date and optionally an hour.
Only, even when I indicate both, a warning occurs preventing me to get the input value.
Here is the warning message in question:
The specified value "0000-00-00T00:00" does not conform to the required format. The format is "yyyy-MM-ddThh:mm" followed by optional ":ss" or ":ss.SSS".
I don't see where does the error or how to solve it.
Upvotes: 2
Views: 5227
Reputation: 212
moment(new Date()).format('YYYY-MM-DDTHH:mm')
Using moment.js it works with this format for type="datetime-local"
Upvotes: 7
Reputation: 116
The datetime-local input accepts date value in the format: {date-value}T{time-value} and {time-value} shouldn't contain the UTC part. So I suppose the problem is in your date value because "00" is not a valid value for day or month
Upvotes: 1
Reputation: 199
The format is valid, the date is invalid: 0th of month 0 of year 0 don't exists.
Upvotes: 2