Skip to main content

Search and Top Navigation

#7786 open bug ()

Opened October 12, 2011 11:09AM UTC

Last modified August 20, 2014 04:17PM UTC

Insertion of invalid number is converted to currentDate but only in first time

Reported by: sestrela Owned by:
Priority: minor Milestone: none
Component: ui.datepicker Version: 1.8.16
Keywords: Cc:
Blocked by: Blocking:
Description

Hello

I found a behavior in datepicker that, seems to me, its a bug. It manifests itself even in the documentation page http://jqueryui.com/demos/datepicker/#default.

When I access the url above for the first time, enter 11111 in the textbox and press enter key, the default date, aka today's date is shown. Then, I clear it, enter 11111 again, press enter key and nothing happens. I refresh the page and it happens again.

What I really wanted to happen was that the value 11111 was cleared automatacly, because it is an invalid date. But i think that, at least, the behavior should always be the same, so if the default date is showned in first access, the default date should always be showned.

Thank you for the great components.

Attachments (0)
Change History (6)

Changed October 11, 2012 02:43PM UTC by scottgonzalez comment:1

milestone: 1.9.01.11.0

Changed October 19, 2012 07:34PM UTC by mikesherov comment:2

status: newopen

Changed October 19, 2012 08:17PM UTC by mikesherov comment:3

#8009 is a duplicate of this ticket.

Changed June 24, 2014 11:38PM UTC by scottgonzalez comment:4

milestone: 1.11.0none

Changed August 20, 2014 10:40AM UTC by DanTup comment:5

I don't see the inconsistent behaviour, for me, date picker *always* returns today for invalid dates.

I don't know how such an issue has been ignored for so long. It seems impossible to use a JQ UI date-picker in any useful way. If the user types nonsense into my field and I ask for the date; I shouldn't just be given an essentially random date and have no way of knowing that's actually what the user typed or not. No user would ever expect my system to do that.

How do the authors intend for this to be used? There's nothing in the docs suggesting there's another way of testing for validity, short of doing your own date parsing (which seems like a ridiculous duplication of effort).

Changed August 20, 2014 04:17PM UTC by tj.vantoll comment:6

Replying to [comment:5 DanTup]:

I don't see the inconsistent behaviour, for me, date picker *always* returns today for invalid dates. I don't know how such an issue has been ignored for so long. It seems impossible to use a JQ UI date-picker in any useful way. If the user types nonsense into my field and I ask for the date; I shouldn't just be given an essentially random date and have no way of knowing that's actually what the user typed or not. No user would ever expect my system to do that. How do the authors intend for this to be used? There's nothing in the docs suggesting there's another way of testing for validity, short of doing your own date parsing (which seems like a ridiculous duplication of effort).

Here's an example of the sort of thing that you can do: http://jsfiddle.net/tj_vantoll/vyj5eesh/. The datepicker rewrite will have an

isValid()
method to simplify this.