mathblogging/mathblogging.org

Localize dates on the client

Closed this issue · 0 comments

pkra commented

Cf. mathblogging/mathblogging-base#2

A small inline script should do the trick.

var times = document.getElementsByTagName("time");
for (var i=0; i < times.length; i++) { 
  var time = new Date(times[i].getAttribute("datetime"));
  times[i].innerHTML = time.toDateString();
}