Primeng: Calendar issue min/maxDate - beta19

Created on 24 Oct 2016  路  4Comments  路  Source: primefaces/primeng

When changing the minDate or maxDate (bound) the UI does not respond to that unless you navigate to the next/prev month.

Example:

import { Component} from '@angular/core';

@Component({
  selector    : 'app-test',
  templateUrl : './test.component.html'
})
export class TestComponent {
 startDate: Date;
  endDate: Date;
  constructor(public err: ErrorsService) {
    this.startDate = new Date('2016-10-10T00:00:00.000Z');
    this.endDate = new Date('2018-10-15T00:00:00.000Z');
  }
}
<b>Start:</b> {{startDate}} <b>End:</b> {{endDate}} <br>
Start <p-calendar [(ngModel)]="startDate" [maxDate]="endDate"></p-calendar><br>
End <p-calendar [(ngModel)]="endDate" [minDate]="startDate"></p-calendar>

image

maxDate of startDate is not visualised at all but should be the value of endDate

image

minDate of endDate is still 10/10 which was the initial value of startDate

If however i do navigate to the next month and come back to the current one (where the selected dates are) everything is ok:

image

Most helpful comment

Same behaviour in beta20

All 4 comments

Same behaviour in beta20

This should be fixed in recent PrimeNG release, please try with it and if the issue persists drop a comment with along with a test case based on plunkr below and we'll review again.

http://plnkr.co/edit/VZbdZfQ7SuTV87tTkbYR

The same incorrect behavior in 5.0.2.

Initially thumbs up this as I believed it wasn't fixed. I was wrong & was using

maxDate='experienceForm.value.endDate' instead of
[maxDate]='experienceForm.value.endDate'

Hope this simple mistake helps others.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lilling picture lilling  路  3Comments

Helayxa picture Helayxa  路  3Comments

papiroca-tm picture papiroca-tm  路  3Comments

SchneMa picture SchneMa  路  3Comments

pchristou picture pchristou  路  3Comments