Open AIO1 opened 10 months ago
By default data
must be a Date
. That's why data = new Date("2024-01-02T17:34:02")
works.
You could use dataType = "string"
but as far as I know your data's format must match dateFormat
.
This means data = "02-Jan-2024"
works but data = "2024-01-02T17:34:02"
fails.
The entire component should be refactored so that it's more flexible on input parsing and output formatting, so that ISO date formats are supported.
Parsing the field value and formatting the output value should be separate from formatting the displayed value. I'd like to keep the value strings as ISO formats, much like OP, and would like to display YY-MM-DD HH:MM for the user.
This is a bug that comes and goes between versions, 90% of the backends return dates as ISO Date String, it is ridiculous that dates have to be converted from ISO string to date before consuming PrimeNg components, and then back to ISO date string before sending to backend. This happens with almost all components that use dates. Please make components able to consume Date() and/or ISO Date string indistinctly. :pray:
Describe the bug
I have the following p-calendar:
The "data" is declared as a date and from a MSSQL database, it is being assigned a datetime2 value like 2024-01-02T17:34:02 With this, p-calendar won't display anything. It will however display the date if this is done:
data = new Date("2024-01-02T17:34:02");
Is this an expected behaviour?
Environment
Development
Reproducer
No response
Angular version
17
PrimeNG version
17.3.0
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
v20.10.0
Browser(s)
No response
Steps to reproduce the behavior
No response
Expected behavior
No response