mathblogging / mathblogging.org

The new home for mathblogging.org
http://mathblogging.org
0 stars 1 forks source link

Localize dates on the client #5

Closed pkra closed 8 years ago

pkra commented 8 years ago

Cf. https://github.com/mathblogging/mathblogging-base/issues/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();
}