How do you parse a date from an HTML5 date input?

后端 未结 6 1093
攒了一身酷
攒了一身酷 2020-12-15 23:40

I have an input on my webpage that I am able to set the date on by getting an ISO string and pulling out the first 10 characters.

date = new Date();
dateInpu         


        
6条回答
  •  渐次进展
    2020-12-16 00:12

    If it's an actual date input on a supporting browser, then it will have a valueAsDate property. There's no need to parse it.

提交回复
热议问题