Basically I have a Date object. How can convert it to a string compatile with datetime-local format yyyy-MM-ddThh:mm?
I tried Date.toISOString method, but it doesn't work as it appends .SSSZ at the end. Gives me the following output The specified value "2017-04-10T17:02:00.320Z" does not conform to the required format. The format is "yyyy-MM-ddThh:mm" followed by optional ":ss" or ":ss.SSS"..
Does anyone have any clean solution to this problem?
datetime-localinput to today's date. Of course the date format can be manually manipulated to fit the required format, but it seems like it would be such a common task that there would be a "clean" way to do it. ThetoISOString().substring(0, 16)worked great for me.toISOString().substring(0, 16)solution.