Hi all,
in line_items object
hs_recurring_billing_start_date field is returned in API as “2024-04-27” while with webhook as “1714176000000”.
Can we fix this to be returned with the same format from both API and webhook?
Thanks
Hi @ASpyropoulos,
Thanks for reaching out to the Community!
I was researching this topic and came across a solution from @karstenkoehler to a similar question in the Community: Workflow “Send a Webhook” is sending wrong data.
Could you take a look to see if this helps with answering your question?
Thanks!
Diana
You have to format the date because the webhook returns the date in timestamp format:
For example, if you are using NodeJs then you have to use the following statements for date formatting:
let date=new Date(1714176000000);
let formatDate=date.getFullYear() + "-" + ("0" + (date.getMonth() + 1)).slice(-2) + "-" + ("0" + (date.getDate())).slice(-2);
I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.
Thanks!
If you’re using Node and you have the Luxon package you can use something like:
// Import the DateTime object from Luxon
const { DateTime } = require('luxon');
// Create a timestamp in milliseconds
const timestamp = 1654848000000;
// Create a DateTime object from the timestamp
const date = DateTime.fromMillis(timestamp);