i have a input with type date, I'm getting input value and i need to compare next input value is +1 day or not. I can't figure out how to do that.
I tried:
is my html:
<input type="date" class="form-control" data-model="startDate">
<input type="date" class="form-control" data-model="endDate">
in my js i set to variable my inputs:
var start_dates = $("#periodTable :input[data-model='startDate']");
var end_dates = $("#periodTable :input[data-model='endDate']");
then i get their values:
var end_date = $(end_dates).val();
var start_date = $(start_dates).val();
i get the value of start_date on console:
2018-12-10
and i need to compare the next input value is: 2018-12-11 or not.
here is i tried to get day part of this output with
var start_date_day = start_date.substring(8, 10);
everything is okey i'm getting: 10
if (start_date_day != start_date_day + 1) {
}
but this case not working beacuse i get with start_date_day + 1 = 11