0

I am using ngbDatepicker in my angular application. I have a couple of requirements.

  1. In the year select box, I need to limit the user to select a year up to 4000. At the same time, I need infinite navigation behavior which is the default in ngbdatepicker. I tried maxDate property, but it is detaching the infinite navigation behavior and it displays the years all at once.

  2. I need to display [-10, +20] years from the currently visible month in ngbdatepicker year select box. The default behavior is [-10, +10] years from currently visible month.

This is what I have tried

 <input class="form-control" 
  type="text" 
  formControlName="dateofJoining" 
  placeholder="Date of Joining" 
  id="inputDateOfJoining" 
  name="doJ" 
  ngbDatepicker 
  #d="ngbDatepicker" 
  [minDate]="{year: 1900, month: 1, day: 1}" 
  [maxDate]="{year: 4000, month: 1, day: 1}" />
vinzzy
  • 1

0 Answers0