Hi, it looks like the code you provided is converting the string date to a Unix timestamp (in seconds), which may not be compatible with HubSpot’s date format. HubSpot expects a date value in ISO 8601 format, which is “yyyy-mm-ddThh:mm:ssZ”.
You can modify your code to convert the string date to the ISO 8601 format before setting it as the output field value.
Here’s an example implementation using the moment.js library:
const moment = require('moment');
exports.main = async (event, callback) => {
const ca_date = event.inputFields['ca_date'];
const date = moment(ca_date, 'MM/DD/YY').format('YYYY-MM-DDTHH:mm:ssZ');
console.log(date);
callback({
outputFields: {
date: date
}
});
}
In this implementation, we’re using moment.js to parse the string date with the ‘MM/DD/YY’ format and format it as an ISO 8601 string using ‘YYYY-MM-DDTHH:mm:ssZ’. You can then set the date variable as the output field value, which should be in the correct format for HubSpot. We always work in this manner at Triotech Systems. I hope this helps!