Page 1 of 1

Calendar timeOnly next day time select issue

Posted: 05 Oct 2021, 13:46
by MariusKF
Hi,
I need a certain case that, I have time scope from today day end to tomorrow day start.
Let, the scope is today 21 to tomorrow 2 (24 hours format)

So, If the minDate on today at 21 o'clock and the maxDate on the next day at 2 o'clock, then the calendar timeOnly component does not give to select a time for the next day like, 1 or 2 o'clock.

component.html

Code: Select all

    <p-calendar
      [timeOnly]="true"
      [(ngModel)]="date"
      [defaultDate]="initialDate"
      [minDate]="minDate"
      [maxDate]="maxDate"
      [hourFormat]="24"
      [stepMinute]="15"
    ></p-calendar>
component.ts

Code: Select all

export class AppComponent {
  date: Date;

  initialDate: Date;

  minDate: Date;

  maxDate: Date;

  ngOnInit() {
    this.initialDate = new Date();
    this.initialDate.setHours(21, 0, 0, 0);

    this.minDate = new Date();
    this.minDate.setHours(20, 59);

    this.maxDate = new Date();
    this.maxDate.setDate(this.initialDate.getDate() + 1); //next day
    this.maxDate.setHours(2, 0); // at 2 AM
  }
}
Here is the stackblitz link to get the issue more clearly:
https://stackblitz.com/edit/primeng-cal ... mponent.ts

Re: Calendar timeOnly next day time select issue

Posted: 25 Oct 2021, 14:19
by merve7
Hi,
Firstly, thank you for your stackblitz example. Please use github issue tracker because this is related PrimeNG Core (https://github.com/primefaces/primeng/issues)

Best regards,
Merve Özçifçi