Datepicker - Uncaught TypeError: Cannot read property 'apply' of undefined

I want to ensure that the user does not select an end date before the start date.  In this scenario, both dates will already be populated (editing an existing row in a calendar pop-up).

I’m using the approach outlined here to use a custom field renderer to override a datepicker:

Specifically the minDate attribute as discussed here:

Here is the code for the custom field renderer:

var field = arguments[0],&nbsp; &nbsp; sdate = arguments[0].row.Start_Date__c; //datetime field<br>&nbsp; &nbsp; value = arguments[1],<br>&nbsp; &nbsp; $ = skuid.$;<br>skuid.ui.fieldRenderers[field.metadata.displaytype][field.mode](field,value);<br>//convert to js date<br>var jsStartDate = skuid.time.parseSFDate(sdate);<br>console.log(jsStartDate);<br>if (field.mode==='edit'){<br>&nbsp; &nbsp;var dateInput = field.element.find('input.hasDatepicker');<br>&nbsp; &nbsp;dateInput.datepicker( "minDate", jsStartDate, true);<br>&nbsp; &nbsp;dateInput.datepicker("refresh");<br>}

The pop-up fails to display, and I get this error:Uncaught TypeError: Cannot read property ‘apply’ of undefined

I’ve searched this error, but cannot find anything applicable to this approach of modifying the datepicker.

Figured it out.  I had dropped one of the parameters.  minDate should be set like this:

...<br>dateInput.datepicker( "option", "minDate", jsStartDate);<br>...