гитигнор подставил
This commit is contained in:
parent
2b3511f69c
commit
08d00aabd6
2 changed files with 23 additions and 1 deletions
23
static/index.js
Normal file
23
static/index.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
const startDate = new Date('2019-06-20T00:00:00Z'); /* будем считать, что именно в это время был первый релиз */
|
||||
|
||||
function updateYearsPassed() {
|
||||
const now = Date.now();
|
||||
const millisecondsPerYear = 1000 * 60 * 60 * 24 * 365.2425; /* учёт високосных лет */
|
||||
const yearsPassed = (now - startDate) / millisecondsPerYear;
|
||||
|
||||
document.getElementById('counter').textContent =
|
||||
`${yearsPassed}`;
|
||||
}
|
||||
|
||||
function updateYear() {
|
||||
const now = new Date().getFullYear();
|
||||
years = document.getElementsByClassName("year")
|
||||
for (year in years) {
|
||||
year.textContent = ` ${now} `}
|
||||
}
|
||||
|
||||
updateYearsPassed(); /* сразу при загрузке */
|
||||
updateYear();
|
||||
setInterval(updateYearsPassed, 10);
|
||||
setInterval(updateYear, 10000);
|
||||
/* код написал чат гопоты, мне осталось лишь подправить. Каюсь, гречневая */
|
Loading…
Add table
Add a link
Reference in a new issue