Show local time for start time
This commit is contained in:
12
scripts/timezone.js
Normal file
12
scripts/timezone.js
Normal file
@@ -0,0 +1,12 @@
|
||||
window.formatTime = function (timeStr) {
|
||||
const date = new Date(timeStr);
|
||||
return date.toLocaleString();
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const elements = document.getElementsByClassName('to-local-time');
|
||||
for (let element of elements) {
|
||||
const innerText = element.innerText;
|
||||
element.replaceChild(document.createTextNode(window.formatTime(innerText)), element.firstChild);
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user