Hello, I’d like to combine the input from separate date and time pickers in a form into one column in my database.
Ive looked through the forum and come across several examples that I am trying to build off of, basically breaking the date and time inputs down to their constituent parts, then building back up to a javascript element in milliseconds to pass on to the database with set field values.
// deconstruct date and time
$w.onReady( function () {
let Y = ($w(“#textDate”).value.getFullYear()-1970)*31556952000;
let M = $w(“#textDate”).value.getMonth()*2592000000;
let D = ($w(“#textDate”).value.getDate()-1)*86400000;
let hour = ($w(“#textTime”).value.slice(0, 2)-3)*3600000;
let min = $w(“#textTime”).value.slice(3, 5)*60000;
let datetime = new Date(Y+M+D+hour+min);
console.log(datetime)
$w(“meetingNotesWrite”).setFieldValue(“dateTime”, datetime);
});
This seems to work in the console log but the database doesnt pick up anything at all (the code for the submit button is elsewhere in the code but is working for other fields.
Any insight?