MediaWiki:EthTime.js: Difference between revisions

From Thorildsby Wiki
Jump to navigation Jump to search
No edit summary
m Protected "MediaWiki:EthTime.js": fragile site shit ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
(No difference)

Revision as of 14:20, 2 October 2025

$(function () {
    var ethTimeDiv = document.getElementById('eth-time');
    const now = new Date();
    const year = now.getUTCFullYear();

    var result = year - 2000;
    var decimal = Math.ceil((now - new Date(year,0,1)) / 86400000);

    decimal = decimal/((year % 4 == 0 && year % 100 != 0) || year % 400 == 0? 366 : 365);

    result += decimal;
    result *= 100;
    result = Math.round(result);
    result /= 100;

    ethTimeDiv.innerHTML = result + "Ð";
}());