primefaces / primeng

The Most Complete Angular UI Component Library
https://primeng.org
Other
10.22k stars 4.55k forks source link

Calendar: dateFormat settings #12944

Open HeneryHawk opened 1 year ago

HeneryHawk commented 1 year ago

Describe the bug

The default value of the property dateFormat is mm/dd/yy where the year is defined with only two y. So when the year is specified with yyyy the year is printed two times.

mm/dd/yy -> 04/25/2023 mm/dd/yyyy -> 04/25/20232023

This is very confusing because normally the full year is defined per yyyy and yy defines only the two digit century. As far as i know this is also defined in ISO 8601.

But unfortunately the PrimeNg Calendar defines here a different format.

Environment

Angular app with latest version of PrimeNg

Reproducer

https://stackblitz.com/edit/github-jqek2c?embed=1&file=src/app/app.component.html

Angular version

14.2.12

PrimeNG version

15.4.1

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.16.0

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

garysb commented 4 months ago

Support for using a proper date format string (ISO 8601) like the rest of the development world should be fixed, especially since using a proper format (for instance when passed over an api) doesn't throw an error, it just happily displays a broken string (take the most common format globally of yyyy-MM-dd that shows the full year twice for example).

A simple solution could be to add a parameter to toggle the format if you are worried that fixing it would break legacy sites.