mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-23 22:27:38 -05:00
browse: Use JavaScript to localize the shown datetime
The datetime format is whatever the user sets in his/her browser or OS. This converts timezones. Tested with Chrome 50 and Internet Explorer 11.
This commit is contained in:
parent
7f35600b28
commit
a41e3d2515
1 changed files with 11 additions and 0 deletions
|
@ -385,5 +385,16 @@ footer {
|
|||
<footer>
|
||||
Served with <a href="https://caddyserver.com">Caddy</a>
|
||||
</footer>
|
||||
<script type="text/javascript">
|
||||
function localizeDatetime(e, index, ar) {
|
||||
if (e.textContent === undefined) {
|
||||
return;
|
||||
}
|
||||
var d = new Date(e.getAttribute('datetime'));
|
||||
e.textContent = d.toLocaleString();
|
||||
}
|
||||
var timeList = Array.prototype.slice.call(document.getElementsByTagName("time"));
|
||||
timeList.forEach(localizeDatetime);
|
||||
</script>
|
||||
</body>
|
||||
</html>`
|
||||
|
|
Loading…
Reference in a new issue