dhtmlx calendar

for debugging

HTML

<script src="http://ecropolis.com/dhtmlx/dhtmlx.js"></script>
<link rel="stylesheet" href="http://ecropolis.com/dhtmlx/dhtmlx.css">
<input name="positionDate" id="positionDate" value="10/13/2014" />
<hr>
<input name="positionDate2" id="positionDate2" value="" />

JavaScript

var thedate = '';

var myCalendar = new dhtmlXCalendarObject(['positionDate','positionDate2']);

myCalendar.setDateFormat("%m/%d/%Y");

    myCalendar.hideTime();

    if(thedate != ''){
        var dateparts = thedate.split('/');
        var dateobj = new Date(dateparts[2],dateparts[0]-1,dateparts[1]);
        //Tried set date with valid date object
            myCalendar.setDate(dateobj); 
        myCalendar2.setDate(dateobj); 
        //Tried set date with date string matching format
            //myCalendar.setDate(thedate);
        //myCalendar.setFormatedDate("%m/%d/%Y", thedate);
    }
$('input[name="positionDate"]').val(thedate);
$('input[name="positionDate2"]').val(thedate);