Ticket #2832 (closed bug: fixed)
Datepicker v3.4.3 $(element).datepicker('getDate') doesn't work properly
| Reported by: | insekticid | Owned by: | iMarc |
|---|---|---|---|
| Priority: | major | Milestone: | 1.2.4 |
| Component: | ui | Version: | 1.2.3 |
| Keywords: | datepicker | Cc: | |
| Blocking: | Blocked by: |
Description
When I enter any date into datepicker input and then I want to get this date with function $(element).datepicker('getDate') I always get "null".
I studied the code and I found this: date from input is parsed only when I opened datepicker!
So now I am using this ugly hack
$(element).datepicker("show"); $(element).datepicker("hide"); parsed = $(element).datepicker('getDate');
Attachments
Change History
comment:3 Changed 5 years ago by insekticid
Hello, here is my hotfix + I added new method for checking, if entered date is in allowed range
comment:4 Changed 5 years ago by insekticid
new methods: isMaxDate, isMinDate
patch v2.0 is the same like patch v2
now It is possible to validate Datepicker dates with validate plugin
$.validator.methods.dateMin = function (value, element, param) {
return $(element).datepicker('isMinDate');
};
$.validator.methods.dateMax = function (value, element, param) {
return $(element).datepicker('isMaxDate');
};
$.validator.methods.dateRange = function (value, element, param) {
return $(element).datepicker('isDateInRange');
};
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

