I am asking for an input of type "date" and then I want to use the received dates stored in variables. I am receiving the user input correctly but the I don't know what type of data to use with JavaSript, currently I'm receiving it as "number" but it's not appropriate.
<form #datesForm = "ngForm" (ngSubmit)="checkDates(datesForm.value)">
<div class="elem-group inlined">
<label>First Day Of Your Plan</label>
<input type="date" name="firstDate" required>
</div>
<div class="elem-group inlined">
<label>Last Day Of Your Plan</label>
<input type="date" name="lastDate" required>
</div>
<button class="btn-fetch" (click)="checkDates(datesForm.value)">Confirm Dates</button>
<div class="elem-group">
<label>Select A Plan Number </label>
<select name="planId" required>
<option value="">Choose a number from the List</option>
<option value="planId">Connecting</option>
</select>
</div>
<button type="submit">Save the Plan</button>
</form>
export class PlansComponent {
@ViewChild('plansForm') form: NgForm;
checkDates(planDates: { firstDate: number, lastDate: number }) {
if (planDates.lastDate - planDates.firstDate <= 7)
confirm("Dates are OK");
else
alert("Only weekly dates");
}
What would you have me use instead of number in my checkDates() method?