Create Date Object

<script type="text/javascript">
function toDate(dateStr) {
    var parts = dateStr.split("-");
    return new Date(parts[2], parts[1] - 1, parts[0]); 
}
var dateObj=toDate("23-02-2017");
var dateObj2=toDate("1-2-2017");
alert(dateObj);
alert(dateObj2);
</script>