I have a list of items that I am displaying on a screen. The HTML template for each item looks like this:
<div>
[Comments]
</div>
<small>Posted on: [date]</small>
[Comments]
will be an actual string of text entered by a user. While [date]
is a JavaScript Date object. I want to display [date]
in a localized date format with the month, day, and year. How can I do this using as plain as possible JavaScript?
Thank you!