Cupara
Well-known member
My problem is that I managed to get my date converted using Javascript but it only shows the converted date for the first entry. I have moved the code to my foreach and still same result.
Here is the template:
Javascript:
Here is the template:
HTML:
<div>
<ol class="block-body">
<xf:if is="$blizzPosts is not empty">
<xf:foreach loop="{$blizzPosts}" value="{$posts}">
<li class="block-row">
<h4 class="node-title">
<img src="/src/addons/GoblinTimes/BlizzardBlueTracker/icons/Wow.png" width="16px" /><span style="margin-left: 5px;" id="created_at"></span> - {$posts.title}
</h4>
</li>
<li class="block-row block-row--separated">
<div class="contentRow">
<div class="contentRow-figure">
</div>
<div class="contentRow-main">
<ol class="block-body">
</ol>
</div>
</div>
<div class="contentRow">
<div class="contentRow-main">
<span style="color: #00AEE9">{$posts.excerpt}</span><br />
<a href="https://us.forums.blizzard.com/en/wow{$posts.url}">More Info...</a>
</div>
</div>
</li>
</xf:foreach>
<xf:else />
<li class="block-row block-row--separated">
{{ phrase('gt_blizz_tracker_no_posts') }}
</li>
</xf:if>
</ol>
</div>
</div>
Javascript:
HTML:
<script>
// Parsing date
var v = '{$posts.created_at}';
var d = new Date(v);
var n = d.toLocaleString();
document.getElementById("created_at").innerHTML = n;
</script>