Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date components does not handle leap years and puts incorrect date. #4200

Closed
Zaixu opened this issue Jan 25, 2024 · 1 comment
Closed

Date components does not handle leap years and puts incorrect date. #4200

Zaixu opened this issue Jan 25, 2024 · 1 comment

Comments

@Zaixu
Copy link

Zaixu commented Jan 25, 2024

Describe the bug
Date components does not wait till user leaves field to correct users data.
As soon as you start typing the year, it corrects the day - But it does not take into context if the year you type is a leap year or not

To Reproduce

  1. Start typing 29-02
  2. Then when you start typing 2-0-2-4 in year field - As soon as you type 2 it corrects it to 28-02.

Can be tested here: https://stackblitz.com/edit/angular-161vu1?file=src%2Fapp%2Fapp.component.ts

Expected behavior

Since leap years exist it should probably first correct the date on input blur as to not make presumptions of input value is wrong.

@stnikolova
Copy link
Contributor

Hi @Zaixu,

This is an expected behavior of the DatePicker component as it is autocorrecting the invalid date parts. In the described case, as soon as '2' is typed for the year part, the year becomes '0002' which is a valid year. However, because it is not a leap year, it autocorrects the day part. If the year is changed first, e.g. to 2024, then typing 29-02 will not be autocorrected.

Please follow this Feature Enhancement item that requests the ability to turn off the autocorrection: https://feedback.telerik.com/kendo-angular-ui/1417908-datevalidation. When implemented, you'd be able to choose that the date is not corrected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants