Calendar timeOnly next day time select issue

Forum rules
Please note that response time for technical support is within 3-5 business days.
Post Reply
MariusKF
Posts: 1
Joined: 12 Nov 2020, 11:04

05 Oct 2021, 13:46

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

merve7
Posts: 861
Joined: 12 Sep 2017, 10:44

25 Oct 2021, 14:19

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

Post Reply

Return to “Ultima - PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests