0

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.

wuwu
  • 13
  • 3
  • can you paste your code whatever you tried – Vikas Kad Dec 19 '22 at 08:29
  • As I have said, I have looked through the attributes of the primeng calendar and haven't actually seen anything that can alter the amount of weeks represented. So I don't have specific code – wuwu Dec 19 '22 at 08:31
  • It would be possible to have only one week to choose from when using `minDate` and `maxDate`, but not to display just one week. – riorudo Dec 19 '22 at 09:26

1 Answers1

1

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.

wuwu
  • 13
  • 3