John, would you be willing to post the solution you had at work? I'm still
trying to get this frackin' thing to work.


Shawn-53 wrote:
> 
> 
> Thanks John.  Your tip pointed me in the right direction.
> 
> Basically I changed my code from
> 
> $("#mycontrol").datepicker("getDate")
> to
> $.datepicker._getInst($("#mycontrol")[0]._calId)._getDate()
> 
> Had to go digging in the ui.datepicker code though to work out the 
> specific function.  (and confirm the formatDate function is still there)
> 
> This *seems* to be doing what I need for now.  I'm sure I'll encounter a 
> bug or two as I get deeper into the code though.  This at least gets me 
> past the initial date hurdles - which were significant seeing as 
> everything is driven from the user entered dates.
> 
> Shawn
> 
> John Morrison wrote:
>> I had the problem the other week, basically the datepicker doesn't let
>> you
>> do getDate until after it's been displayed.  I emailed the folks who
>> wrote
>> datepicker and they did get back with a solution, but that's at work and
>> I'm not for the next week.
>> 
>> I can get it you then... but from memory,
>> 
>> $('#dFrom').datepicker({
>>     defaultDate: '-1m',
>>     minDate: '-3m'
>> });
>> 
>> set the date correctly, to get the date you need the instance...
>> 
>> $.datepicker._getInst($('#dFrom')[0]._calId)._getMinMaxDate('min')
>> 
>> that gets the MinMaxDate, I can't remember what the GetDate function is
>> called.
>> 
>> You might be interested in the rest of the code, two textboxes with
>> custom
>> range with overall min/max set...
>> 
>> $('#dTo').datepicker({
>>     maxDate: 0
>> });
>> 
>> // Customize two date pickers to work as a date range
>> function customRange(input) {
>>     return {
>>         minDate: (input.id == 'dTo' ?
>>             $('#dFrom').datepicker('getDate') :
>>            
>> $.datepicker._getInst($('#dFrom')[0]._calId)._getMinMaxDate('min')),
>>         maxDate: (input.id == 'dFrom' ?
>>             $('#dTo').datepicker('getDate') :
>>            
>> $.datepicker._getInst($('#dTo')[0]._calId)._getMinMaxDate('max'))
>>     };
>> }
>> 
>> Sorry I can't give you the exact code, but I think once you get the
>> instance you've got the rest.
>> 
>> J.
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/ui.datepicker-trouble-tp17846951s27240p18469716.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to