How to set date in format not supported by Calendar Module of PrimeNG?

UI Components for Angular
Post Reply
ashitvora
Posts: 1
Joined: 21 Jun 2019, 09:18

21 Jun 2019, 09:20

I am using the Calendar Module of PrimeNG in my app. I allow customers to specify the format in which they want to see the date. This is the migration of the old app to Angular so I want to persist old format configured by the user.

In the older version, we had formats like

yyyy/MM/dd HH:mm:ss (eg. 2019/05/22 05:55:43)
'Q'Q yyyy (First Q should be displayed as is as it is wrapped in quotes whereas 2nd quote should be replaced with the Quarter of the selected date. Eg. Q2 2020
yyyy/mm/dd HH (eg. 2019/05/22 05)
We also allowed users to create their custom format using these string literals.
Now CalendarModule uses a different format so I am converting yyyy to yy for full year and yy to single y for last 2 numbers of the year. Similarly, I am converting upper case MM to lower case mm since that's what Calendar Module understands but there are no literals for Hour, Minutes and Seconds specified in the documentation of PrimeNG.

Moreover, when a user types any custom date - Q2 2019, I want to keep it as is but Calendar sets it's value as null enough though I have set keepInvalid attribute to true - [keepInvalid]="true"

Will appreciate any help on this.

Thanks!

Cross Posted from https://stackoverflow.com/questions/566 ... of-primeng

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 22 guests