#5793 closed bug (notabug)
Datepicker + Masked Input
Reported by: | marcos.pont | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | ui.datepicker | Version: | 1.8.2 |
Keywords: | parseDate, updateDatePicker, masked input | Cc: | |
Blocked by: | Blocking: |
Description
When using Datepicker with Masked Input plugin, the input value is cleared out when the user types a date value.
This happens because JUI Datepicker considers dates with 2 digit year as valid dates inside the parseDate method.
So, if a valid date is found (for instance, 07/04/10), the _updateDatePicker method is called and then the native focus() function is called on the input.
This calls the focus handler on Masked Input plugin. If the mask defined for the field expects year with 4 digits, the 2 digit year will make the date invalid and the input will be cleared out.
My suggestion is: is it possible for Datepicker to accept years with 2 digits based on a configuration setting? This would help developers using Datepicker and Masked Input to make them work together.
I have tried to think of a solution that would change Masked Input's code, but I couldn't. Since the entered value is not a full date, it does not respect the defined mask and there's no workaround for this.
Thanks in advance!
Change History (4)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
Hi, After having same problem (Datepicker + Masked Input), I just removed the call to focus() at the end of _updateDatepicker() and I'm very happy with this new behavior. For me, leaving updateDatepicker() without calling focus() at all is quite acceptable.
comment:3 Changed 10 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
The datepicker supports specifying a date format. This is definitely not a bug in datepicker.
I have made more research on how to find a fix for this issue.
In order to make Datepicker work with Masked Input plugin, we would need 2 things: