First, you need to build the date using padStart to apply zeroes only where necessary.
Then, you should only need to use the .val function to set that date.
Note, commented line “alert(date);” was just to make sure the date was actually being formatted how I wanted.
$(document).on(‘knack-view-render.view_6’, function(event, scene) {
var date = new Date();
var dd = String(date.getDate()).padStart(2, ‘0’);
var mm = String(date.getMonth() + 1).padStart(2, ‘0’); //January is 0!
var yyyy = date.getFullYear();
date= mm + '/' + dd + '/' + yyyy;
//alert(date);
$(’#view_6-field_28-time’).val(date);
});
I use a function similar to this that sets a Field named “Week Ending” to the next Friday from the current date.