Is it possible to show only 1 week using PrimeNG calendar?

680 Views Asked by At

Is it possible to show only one week in the calendar view? Like on the image (taken from another question).

I looked through the attributes of the element and haven't found anything that might change the amount of weeks being represented. Or maybe you have suggestion for another library that can do that? Thank you.

1

There are 1 best solutions below

0
On

So, it is actually possible to display only 1 week but only to display. From their documentation, where they explain conditional styling for the specific days:

<p-calendar [(ngModel)]="date10">
    <ng-template pTemplate="date" let-date>
        <span [ngStyle]="{display: (date.day < 21 && date.day > 10) ? 'none' : 'block'}">{{date.day}}</span>
    </ng-template>
</p-calendar>

I did not look further into how to switch weeks instead of months from the calendar view because it is simply not worth the effort.