I’m using Moment.js and this code works on another page and updates relativetime
with the relative time since the timestamp.
<p id="relativetime"></p>
<script>
$("#relativetime").text(moment("Sun Aug 30 2020 15:58:59 GMT+0000 (Coordinated Universal Time)").fromNow());
</script>
But, instead, on this page, it shows ‘Invalid date’. If I go into DevTools and paste in the code within the script tags, it updates with the relative time. What’s going on here? Any ideas?