添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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?

Hi @tkoseoglu

you need to convert the date into a timestamp here. In JS it should look something like this

new Date ("2024-10-01").valueOf();

I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.
Thanks!

Hi @tkoseoglu

you need to convert the date into a timestamp here. In JS it should look something like this

new Date ("2024-10-01").valueOf();

I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.
Thanks!

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);

Best,

Jaycee

HubSpot’s AI-powered customer agent resolves up to 50% of customer queries instantly, with some customers reaching up to 90% resolution rates.
Learn More.
Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !
Hi @tkoseoglu  you need to convert the date into a timestamp here. In JS it should look something like this new Date("2024-10-01").valueOf(); I hope this will hel... Hi @tkoseoglu  you need to convert the date into a timestamp here. In JS it should look something like this new Date("2024-10-01").valueOf(); I hope this will hel... Developers Nov 13, 2024 //START END-USER CONFIGURATION //------------------------------ //selectors for hover card triggers var allHoverCardTriggers = '.author-name-link,.friend-list .friend a,.username a,.avatar,.user-avatar,.author-img, .authors a, .messageauthorusername a, a.lia-user-name-link, .js-latest-post-by-from a, .user-online-list li a, a.UserAvatar, .customUsersOnline a, #authors a,.dashboard-followers a.user-name, .dashboard-following a.user-name,.author-login-wrapper a, .hb-leaderboard a, .author-img-floated'; // Forward calling page's URL params to endpoint URL as well, helps with testing! var params = (new URL(location.href)).searchParams; var userApiUrl = '/plugins/custom/hubspot/hubspot/hovercardendpoint?' + ((params.set('user_id', '') == []._) && params.toString()); if($('.hover-card-container').length<1){ $('body').append('
'); var cardWrapper = $('.hover-card-container'); var error = false; var thisUserID = ''; var thisUserLogin = ''; var userLink =''; var cardTimer; var leaveTimer; function mouseenter(Elem) { var thisEl = Elem; cardTimer = setTimeout(function(){ var docWidth = $(document).width(); var rightSide = false; var userLink = thisEl.attr('href'); if($('.ViewProfilePage').length && $('img.lia-user-avatar-profile',thisEl).length){thisUserID = '';} else if(thisEl.attr('href')=='#' || thisEl.attr('href')=='' || !userLink.match('viewprofilepage')){ return false;} else{ var thisLen = (userLink).split('/'); thisUserID = (thisLen)[thisLen.length-1]; var thisCard = $('.profileCard[data-user='+thisUserID+']',cardWrapper); var cardId = 'userProfileCard-'+ thisUserID; var addAttr = thisEl.attr('aria-describedby',cardId); var thisElTopOffset = Math.round(thisEl.offset().top+(thisEl.height()/2)+30); var thisElbottomoffset = "auto"; var className = ""; var winHeight = $(window).height(); var elOffset = thisEl.offset(); var scrollTop = $(window).scrollTop(); var elementOffset = thisEl.offset().top; var distanceTop = (elementOffset - scrollTop); var distanceBottom = (winHeight + scrollTop) - (elOffset.top + thisEl.outerHeight(true)); var distanceLeft = Math.round(thisEl.offset().left); var bodyHight = $('body').height(); var topParam = ''; var bottomparam = ''; var position = ''; var className = 'topArrow'; cardId if(distanceBottom < 300 ){ if(distanceLeft < 59){ thisCard.removeClass('bottomArrow'); var className = 'leftArrow'; var distanceLeft = (distanceLeft)+(39); var thisElTopOffset = (thisElTopOffset)-(150); }else{ var thisElTopOffset = (thisElTopOffset)-(301); var className = 'bottomArrow'; thisCard.removeClass('topArrow'); thisCard.removeClass('leftArrow'); var distanceLeft = (distanceLeft)-(45); else{ if(distanceLeft < 59){ thisCard.removeClass('topArrow'); var className = 'leftArrow'; var distanceLeft = (distanceLeft)+(39); var thisElTopOffset = (thisElTopOffset)-(150); }else{ thisCard.removeClass('leftArrow'); thisCard.removeClass('bottomArrow').addClass('topArrow'); var distanceLeft = (distanceLeft)-(45); if(thisCard.length && $('.profileCard[data-user='+thisUserID+'] .preloader',cardWrapper).length<1){ $('.profileCard',cardWrapper).hide(); thisCard.addClass(className); rightSide?thisCard.addClass('rightArrow'):thisCard.removeClass('rightArrow'); thisCard.delay(0).css({'top':(thisElTopOffset),'left':distanceLeft,'bottom':thisElbottomoffset}).fadeIn(); } else { var ajaxReturn = ''; //just in case thisCard.remove(); //hover card wrapper markup var rightArrowClass = rightSide?'rightArrow':''; if(thisElTopOffset != "auto"){ topParam = 'px'; if(thisElbottomoffset != "auto"){ bottomparam = 'px'; var profileCardHtml = '