[FIXED] PrimeNG p-calendar month picker not working

Issue

I have copied code from PrimeNG for month picker. And it’s work great but for some reason it’s not working like on the PrimeNG example – the year stays the same when clicking on arrows buttons. But ngModel is changing properly.
Visualization

<div class="p-fluid p-grid p-formgrid">
  <div class="p-field p-col-12 p-md-4">
    <label for="monthpicker">Month Picker</label>
    <p-calendar
      [(ngModel)]="date12"
      view="month"
      dateFormat="mm/yy"
      [yearNavigator]="true"
      yearRange="2000:2030"
      [readonlyInput]="true"
      inputId="monthpicker"
    ></p-calendar>
  </div>
</div>

Solution

HERE your own code working fine:

It’s a well-known bug:
https://github.com/primefaces/primeng/issues/11038

It has been fixed in primeng 13.0.5 ( 19 days ago).
You would have to update your primNg in order to fix it (try with latest: PrimeNG 13.1.0).

NOTE: "yearRange", "yearNavigator" are deprecated.

Answered By – Juan Vicente Berzosa Tejero

Answer Checked By – Terry (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published