Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Datetime-local input doesn't accept the specified value

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.

like image 977
MedMatrix Avatar asked Sep 14 '26 02:09

MedMatrix


2 Answers

moment(new Date()).format('YYYY-MM-DDTHH:mm')

Using moment.js it works with this format for type="datetime-local"

like image 181
ABC Avatar answered Sep 15 '26 18:09

ABC


The format is valid, the date is invalid: 0th of month 0 of year 0 don't exists.

like image 40
Gromish Avatar answered Sep 15 '26 18:09

Gromish