Opened 7 years ago

Last modified 5 years ago

#7786 open bug

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.

Change History (6)

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

Milestone: 1.9.01.11.0

comment:2 Changed 6 years ago by mikesherov

Status: newopen

comment:3 Changed 6 years ago by mikesherov

#8009 is a duplicate of this ticket.

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

Milestone: 1.11.0none

comment:5 Changed 5 years ago by 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).

comment:6 in reply to:  5 Changed 5 years ago by tj.vantoll

Replying to 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.

Note: See TracTickets for help on using tickets.