Reputation: 19238
<input name="datetime" type="datetime-local" />
The above input only works with valueAsNumber
, when I switch to valueAsDate
it returns null.
I guess it's because failed to convert into Date
?
Upvotes: 2
Views: 2012
Reputation: 3152
Your input is not a date, it is a datetime
You are correct, it failed to convert into Date.
You could do this instead:
var datevalue = new Date(myinput.value);
Upvotes: 2