I would like to display the w" /> I would like to display the w" /> I would like to display the w"/>

PrimeNG p-calendar: display week of year in input field

22 Views Asked by At

I am using PrimeNG <p-calendar>:

<p-calendar [(ngModel)]="mydate" view="date" dateFormat="MM yy" [readonlyInput]="true">

I would like to display the week of the year and the year in the input field, which doesn't seem to be possible with dateFormat according the docs. Is there a way to customize the format of the date display in the input field? I am using ngx-moment and I could render the desired text like this:

{{mydate | amDateFormat:'[Week ]WW Y'}}

Which results in:

Week 11 2024

Is there a way to bring a template string into the input field? Or any other trick? Note, that I have set the input field read only with [readonlyInput]="true". So it's not a problem if the string is not parsable back into a date.

0

There are 0 best solutions below