Reputation: 5677
I have a piece of code like below, which produces an invalid Date
.
var pickedUpDate = new Date(val + 'T13:00:00');
I am not sure what this piece of code does with 'T13:00:00'
.
The val
i am passing is like "11/11/2222"
.
In the later stage, i am using it like below:
if (pickedUpDate < currentDate.setHours(0, 0, 0, 0)) {
}
Upvotes: 2
Views: 39
Reputation: 90776
This is an ISO date with a format like 'yyyy-mm-ddThh:mm:ss' so you should set your val to something like 2017-12-30
so that it gives 2017-12-30T13:00:00
.
Upvotes: 2