I have to format a date, but said date is inside a template literal, I cannot create a variable outside, and format it before, I think, since it is inside of a map function:
$.getJSON(  base_url + '/xxx/wp-json/wp/v2/news?housing_type' + id, posts => { 
    $('.page__content__news__inner-wrap').html(`
        ${posts.map( item =>
            `<div class="news__item"><a href="${item.news_url}" class="news__item__link" target="_blank"><p class="news__item__date">${item.date}</p><h3 class="news__item__title">${item.title.rendered}  </h3></a></div>`)}
    `);
});
What I need to do is to display this part:
${item.date}
With a specific format, something like this (which of course doesn't work):
${item.date}.format("mmmm d, yyyy")
Is there a way to add ${item.date} to a variable in this scenario so I can format it?
