I am posting to an HS entity which has, among other data types, a property of type Date Picker.
As per your documentation, it expects a UNIX formatted LONG. The POST works and all is good until I get the response body back. Now, the exact same property that expected a LONG as input, spits out a string in the format of “2024-10-01”. So, the input is 17434343000 and the output is “2024-10-01”?
How are we supposed to parse that into the same property that has a type of LONG? Why doesn’t the API spit out a LONG, just like expected it as the input?
Hey, @tkoseoglu Thanks for your post. It’s a valid comment.
HubSpot doesn’t publish the underlying “why” in its documentation. I can confirm the endpoint is working as intended, even if it’s not returning a response in the format you are expecting. You’ll need to convert the ISO string back to UNIX timestamp if you are using the response in additional requests. I agree, this adds an extra layer of complexity to your process.
For other users who may come across this post, here is a quick example of one way to covert this back to UNIX format using JS
const dateStr = "2024-10-01";
const date = new Date(dateStr);
const unixTimestamp = date.getTime();
console.log(unixTimestamp);