}
const date = new Date();
const timestamp = (date.getTime() - date.getMilliseconds()) / 1000;
- if (_offset === null)
- _offset = timestamp - window.TIME_NOW;
document.querySelectorAll("time").forEach((element) => {
rebuild(element, date, timestamp);
});
* Transforms <time> elements on init and binds event listeners.
*/
function setup() {
+ _offset = Math.trunc(Date.now() / 1000 - window.TIME_NOW);
new Repeating_1.default(refresh, 60000);
Listener_1.default.add("WoltLabSuite/Core/Date/Time/Relative", refresh);
document.addEventListener("visibilitychange", onVisibilityChange);
const date = new Date();
const timestamp = (date.getTime() - date.getMilliseconds()) / 1_000;
- if (_offset === null) _offset = timestamp - window.TIME_NOW;
document.querySelectorAll("time").forEach((element) => {
rebuild(element, date, timestamp);
* Transforms <time> elements on init and binds event listeners.
*/
export function setup(): void {
+ _offset = Math.trunc(Date.now() / 1_000 - window.TIME_NOW);
+
new RepeatingTimer(refresh, 60_000);
DomChangeListener.add("WoltLabSuite/Core/Date/Time/Relative", refresh);