I am trying to grab the current post PublishedDate, and hashtags and apply them to the text of a UI Text element. Here is my code.
import wixData from 'wix-data'; import wixLocation from 'wix-location'; $w('#post1').getPost() .then( (post) => { let postTitle = post.title; let postContent = post.plainContent; let postImage = post.coverImage; let postExcerpt = post.excerpt; let postDate = post.publishedDate; $w("#columnStrip8").background.src = postImage $w("#text10").text = postTitle $w("#text11").text = postDate // see example post object below } ) .catch( (error) => { console.log(error); } );
Everything works, except the postDate, and if I try to recall post.hashtags. The cover image updates, excerpt shows up, and the title works fine.
Any suggestions?
Thanks
In order to set #text11, you need to convert postDate to a string:
$w("#text11").text = postDate.toString();
Hashtags are returned as an array of strings, so you will first have to format the hashtags as a string.