Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#9419 closed bug (duplicate)

With a 4 digit year or 2 digit month format, the altField value changes before you are done typing.

Reported by: worpet Owned by:
Priority: minor Milestone: none
Component: ui.datepicker Version: 1.10.3
Keywords: Cc:
Blocked by: Blocking:

Description

Set the dateFormat to "mm/dd/yy".

Attempt to enter this date into the altField: "01/01/1999". As soon as you enter the the "1" for "1999", the field value and calendar will change to "01/01/2001". Next, with focus after the last character in the altField, try to backspace to fix it. As soon as you backspace to "01/01/20", the field value and calendar will change to "01/01/2020".

The problem seems to be due to in doKeyUp it will attempt to parse the input into a date and then change the value of the altField to that date. After entering characters up to "01/01/1", the "1" at the end seems to get parsed into "2001", despite that "yy" indicates a 4 digit date.

Here is a JSFiddle: http://jsfiddle.net/NKL5h/9/

Change History (3)

comment:1 Changed 6 years ago by worpet

It looks like the issue described in ticket #8353 could be the root cause of this.

comment:2 Changed 6 years ago by tj.vantoll

Resolution: duplicate
Status: newclosed

Duplicate of #8353.
Hi worpet,

Thanks for taking the time to contribute to the jQuery UI project. I'm going to mark this one as a duplicate as #8353 is the cause of this. parseDate should throw an error which would prevent the altField from being updated.

If you are interested in looking into #8353 feel free to submit a patch via a pull request.

Thanks.

comment:3 Changed 5 years ago by java4life

I saw this bug and this is clearly not duplicate of the bug #8353. Behavior is totally different. The bug #8353 is about field taking wrong date format. This bug is about field changing what you are typing.

Maybe you do not want to fix it right now but this is not a duplicate of the bug #8353.

Note: See TracTickets for help on using tickets.