Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

242
Views
ngb date picker disable past date angular

I am using ngb date picker for my forms. I am using below code for it. Its working well. I need to disable past date disable (user can select current date onwards).

  <input class="form-control ngbfield" (dateSelect)="loadCheckinTime(checkin.checkdate)"
                                placeholder="yyyy-mm-dd" required name="checkdate" [readonly]="true" #vl="ngModel"
                                [(ngModel)]="checkin.checkdate" ngbDatepicker [markDisabled]="isDisabled"
                                #d1="ngbDatepicker" required>
                            <div class="input-group-append">
                                <button class="btn btn-outline-secondary fa fa-calendar" (click)="d1.toggle()"
                                    type="button"></button>
                            </div>

How i disable past date.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use input binding [minDate]

  <input class="form-control ngbfield" [minDate]="minDate"(dateSelect)="loadCheckinTime(checkin.checkdate)"
                            placeholder="yyyy-mm-dd" required name="checkdate" [readonly]="true" #vl="ngModel"
                            [(ngModel)]="checkin.checkdate" ngbDatepicker 
                            #d1="ngbDatepicker" required>

ts File

minDate : any;

constructor() {
  const todayDate = new Date();
  this.minDate = {
    year: todayDate.getFullYear(),
    month: todayDate.getMonth() + 1,
    day: todayDate.getDate()
  };
}
                       
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!