Invalid date on JavaScript on .Net Core project

I’m having the next issue:

<input type="hidden" value="@Model.EndDate" id="dateEnd" />

in the hidden input, I have a Date value from a Model this value is 2019/12/31

So I’m trying to use it in JavaScript for some logic in the webpage, here is how I catch it:

const endDate = new Date(document.querySelector("#dateEnd").value);

When I do this and do a "console.log", the console shows me "Invalid Date".

Any idea why this happens?

43 thoughts on “Invalid date on JavaScript on .Net Core project”

  1. 204021 266575Oh my goodness! an outstanding post dude. Thank you Nonetheless Im experiencing problem with ur rss . Do not know why Cannot register for it. Could there be any person obtaining identical rss difficulty? Anybody who knows kindly respond. Thnkx 487744

    Reply

Leave a Comment