Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#10746 closed bug (notabug)

Datepicker mm/dd/y format doesn't support years before 1929

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

Description

Datepicker with format, where is not complete year part (e.g. "mm/dd/y") doesn't support years before 1929.

Steps to reproduce: 1) Select some date before 1929

See demo: http://jsfiddle.net/Lhk94t8z/7/ Browser: Chrome

Change History (8)

comment:1 in reply to:  description Changed 6 years ago by jvic

Year 1928 is ok. Problem is from year 1926.

comment:2 Changed 6 years ago by Scott González

Resolution: notabug
Status: newclosed

Correct 1926, because today we are in 2015 and the shortYearCutoff defaults to "+10" (see the documentation). I'm not sure how you expected this to work since it's completely ambiguous.

comment:3 Changed 6 years ago by jvic

You are wrong.

Check this updated jsfiddle: http://jsfiddle.net/Lhk94t8z/8/ If I call setDate() with Date object (year 1912) and after that I call getDate() datepicker must return same value.

Last edited 6 years ago by jvic (previous) (diff)

comment:4 Changed 6 years ago by Scott González

That's impossible since the canonical source is lossy, as specified by you via the date format.

comment:5 Changed 6 years ago by jvic

Hi,

1) It's possible. Datepicker has internally stored date object. There is no loss, when user don't edit input manually. I prepared nasty fix: http://jsfiddle.net/Lhk94t8z/9/

2) If it's not bug, please explain why following UC in this jsfiddle (http://jsfiddle.net/Lhk94t8z/8/) returns 1912.

  • setDate (1912)
  • getDate (2012)
  • setDate (1912)
  • getDate (1912)

comment:6 Changed 6 years ago by Scott González

#2 sounds like a bug.

comment:7 Changed 6 years ago by jvic

Should I open new ticket with #2?

comment:8 Changed 6 years ago by Scott González

If you want to. Considering this is tied to lossy date formats, I'm not sure it will be fixed before the rewrite is done, unless someone sends a PR.

Note: See TracTickets for help on using tickets.