Opened 8 years ago

Last modified 5 years ago

#7098 open bug

Datepicker: Broken handling of four digit years before year 100

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

Description

When entering an early four-digit year, i.e. 03/04/11, it will be translated to 03/04/2011 in the year browser. This is incorrect; a four digit year of 03/04/11 must be 03/04/0011 in the four digit year format and shown as such. Additionally, trying to manually correct it using 03/04/0011 still shows the wrong date picker, for 2011 instead of 0011.

This bug makes it impossible to correctly browse and enter early dates for historical data entry and processing.

Change History (8)

comment:1 Changed 8 years ago by kzys

Because Datapicker has shortYearCutoff and default value is +10. If you want to use Datapicker on historical data application, please try shortYearCutoff: 0.

http://jqueryui.com/demos/datepicker/#option-shortYearCutoff

comment:2 in reply to:  1 Changed 8 years ago by bombo

Setting shortYearCutoff to 0 does not seem to do the trick. In fact it seems to result in some strange behavior in terms of emulating shortYearCutoff: 21 or something like that.

Here is a jsfiddle sample, reproducing said behavior:

http://jsfiddle.net/bombo/47f7D/24/

Even when inputting 01/01/0001, the datepicker seems to store 01/01/2001 internally, as can be seen when doing so and pressing Show date.

comment:3 Changed 7 years ago by Scott González

Milestone: 1.9.01.11.0

comment:4 Changed 7 years ago by mikesherov

Status: newopen

confirmed on latest: http://jsfiddle.net/LgVqM/7/

comment:5 Changed 6 years ago by tj.vantoll

#9488 is a duplicate of this ticket.

comment:6 Changed 6 years ago by tj.vantoll

Milestone: 1.11.0none
Summary: Broken handling of four digit years before year 100Datepicker: Broken handling of four digit years before year 100

Test case from brunobg in #9488: http://jsfiddle.net/NYNCh/.

comment:7 Changed 6 years ago by tj.vantoll

#9600 is a duplicate of this ticket.

comment:8 Changed 5 years ago by brunobg

Sent a pull request with the fix: https://github.com/jquery/jquery-ui/pull/1142

Note: See TracTickets for help on using tickets.