Hi all,
As the title suggests Company closedate field does not return the correct value in API and Webhook.
ie: 30/05/2024 (Value in the UI)
Webhook returns value = 1717016400000 (which is Wed May 29 2024 21:00:00 GMT+0000)
API returns value = 2024-05-29T21:00:00Z
Can you please assist?
UI screenshot

Hi @ASpyropoulos
Both values are the same, but their formats differ. Webhook returns a UNIX timestamp in milliseconds whereas API returns a human-readable date. You can convert the human-readable date into timestamp format using the following JavaScript Statement:
new Date('2024-05-29T21:00:00Z').valueOf();
Which returns the value 1717016400000. If you want to convert timestamp to human-readable format using the following JavaScript Statement:
new Date(1717016400000).toISOString()
Which returns the value '2024-05-29T21:00:00.000Z’.
I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.
Thanks!
Thanks for the reponse Gaurav. Yes these 2 are equivelant. However both they are not the same as the one that UI shows which is 30/05/2024.
So the problem is that the UI value is not equivelant with the one that webhook and API sends
Hi @ASpyropoulos
If you will use the following JS statement:
new Date(1717016400000).toLocaleDateString()
then it will return ‘30/05/2024’.
Note: toLocaleString() returns date according to language-specific conventions whereas toISOString() returns date according to universal time.
Thank you Gaurav. So I guess the timestamp returned from the webhook and API is in UTC and is correct. Then according to where do I want to display this date value using toLocaleDateString will show the date with correct timezone.