1

I have two input date fields i.e Invoice Date and Invoice Due Date. Using Angular how can i make the Invoice Due Date not less than the Invoice Date?

I am new to Angular, so I really don't know how to proceed.

   <div class="col-sm-2">
                <label>Invoice Date</label><br>
                <input type="date" [disabled]="true" name="invoicedate" class="form-control readOnly-date" [(ngModel)]="invoice.invoiceDate" *ngIf="!invoice.financialPeriodId">
                <input type="date" name="invoicedate" min="{{startDate | date: 'yyyy-MM-dd'}}" max="{{endDate | date: 'yyyy-MM-dd'}}" class="form-control" [(ngModel)]="invoice.invoiceDate" *ngIf="invoice.financialPeriodId">
            </div>

            <div class="col-sm-2">
                <label>Due Date</label><br>
                <input type="date" name="dueDate" class="form-control readOnly-date" [(ngModel)]="invoice.invoiceDueDate" *ngIf="!invoice.invoiceDate">
                <input type="date" name="dueDate" class="form-control" [(ngModel)]="invoice.invoiceDueDate" *ngIf="invoice.invoiceDate">
            </div>

Depending on the value for the Invoice Date, the Invoice Due Date should not be less than the Invoice Date

1 Answer 1

1

Try [min]="invoice.invoiceDate" like this:

<input type="date" name="dueDate" class="form-control" [(ngModel)]="invoice.invoiceDueDate" *ngIf="invoice.invoiceDate" [min]="invoice.invoiceDate">

Working Demo

Sign up to request clarification or add additional context in comments.

1 Comment

Please upvote and accept this answer if this helped :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.