Html5 datetime-local values ​​if not complete

In chrome - I do not know in another browser (and this time I do not care, but the answer is valid for any of them) - if you have not set the entire date (for example, there is not enough hour and minute -: -), the input value is empty. ..

How can I find out which values ​​have not been entered? or does chrome wait to set the input value until all fields are set?

I thought of a cruel method that I don't like: set the default value (for example, today or 1/1/1970), then chrome should set the input value, then all the values ​​are fine even if the user does not set the date manually.

<input id="INPUT" type="datetime-local" name="ciccio">

Rendering is similar to

**-**-**** --:--

where * is the field for the day, month, year.

If you type this:

12-03-2013 --:--

and requesting an INPUT value using javascript

console.log($('#INPUT').val());
//the result is "" (nothing).

-

+4
1

. , , , , .

0

Source: https://habr.com/ru/post/1524286/


All Articles