I’m trying to update my date picker with a value
Everywhere else in the code, it works. This code structure works and updates. If I add button to set the date in this exact same format, it updates and properly sets the value.
However, in this one specific block of code, the element fails to update. I’ve had similar problems with the dropdown elements before, but this is the first time the Date Picker hasn’t updated
For reference here’s the code. The comments show the values on runtime for reference. Nothing else is connected/affecting this Date Picker

if(data.individual.dateOfBirth){
console.log(data.individual.dateOfBirth); //'Fri Jan 13 2017'
console.log(typeof data.individual.dateOfBirth); //string
const date = new Date(data.individual.dateOfBirth);
console.log(date); //object --> Date printed properly for default date object
console.log(date.toDateString()); //'Fri Jan 13 2017'
$w('#dateOfBirth').value = date;
//date is still blank and unaffected after this point, as if the above line does not exist
}
Any idea why this format is not working? Again if I add this same code to a button to manually trigger the update, it works. But in this block, which runs it does not.