1

I'm trying to add styling for some disabled dates on primeNG calendar, in the documentation it's suggested to use disabledDateTemplate. However, that does not seem to work and I couldn't find a single solution online either.

Muhammed Albarmavi
  • 23,240
  • 8
  • 66
  • 91
ash
  • 53
  • 1
  • 7

1 Answers1

0

you can overwrite the style of disabled date like this

style.css

p-calendar td span.p-disabled {
  color: red !important;
  background: orange !important
}

global theme

or you can set a custom class so the style will not effect all component

template

<p-calendar styleClass="custom-theme" 
            [(ngModel)]="dateValue" 
            [disabledDates]="invalidDates" 
            [disabledDays]="[0,6]" 
            [readonlyInput]="true">
</p-calendar>

style.css

p-calendar .custom-theme  td span.p-disabled {
  color: #fff !important;
  background: darkred !important
}

enter image description here

demo

Muhammed Albarmavi
  • 23,240
  • 8
  • 66
  • 91
  • problem with this approach is dates im disabling using [mindate] attribute gets styled too. Also i want to style the dates by three different colours. – ash Sep 11 '20 at 18:01
  • can you edit the demo to match your code so I can see your case correctly, you don't mention these problem in your answer – Muhammed Albarmavi Sep 11 '20 at 18:48
  • yea i should have specified about the minDate, sorry about that. Anyways here is the forked stackblitz code, https://stackblitz.com/edit/primeng-calendar-demo-b8cbeb?file=src/app/app.component.html as you can see dates that are disabled by midDate gets styled too. I want to style some specific disabled dates. – ash Sep 12 '20 at 04:24