I have a Twig template and inside of it I am trying to display the current date using JavaScript, but the date does not get rendered on the screen for some reason, why and how can I output the current date?
Here is my twig snippet:
<p>By <a class="author-a">Kelly Chang</a> | <script>var today = new Date();
var dd = String(today. getDate()). padStart(2, '0');
var mm = String(today. getMonth() + 1). padStart(2, '0'); //January is 0!
var yyyy = today. getFullYear();
today = mm + '/' + dd + '/' + yyyy
document.write(today);
</script>
</p>