subtitle fix

This commit is contained in:
fruworg 2023-07-31 21:36:59 +06:00
parent e8114cf67f
commit c6ca808d23
2 changed files with 2 additions and 39 deletions

View File

@ -10,6 +10,7 @@
<div class="site-description">
{{- if isset .Site.Params "description" -}}
<pre>{{ template "partials/subtitle.html" . }}</pre>
<script src="static/"></script>
{{- end -}}
</div>
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}

View File

@ -1,41 +1,3 @@
добро пожаловать на мой
<a href="https://github.com/fruworg/fruw.org">open-source</a> веб-сайт!
<time style="color: var(--maincolor)" id="time">тут должно было быть время</time>
<script>
// Функция для форматирования числа (добавляет ведущий ноль, если число меньше 10)
function formatNumber(num) {
return num < 10 ? '0' + num : num;
}
// Функция для получения текущего времени и даты в поясе UTC+6
function getCurrentDateTimeUTCPlus6() {
const currentTime = new Date();
const offset = currentTime.getTimezoneOffset(); // Получаем разницу в минутах между UTC и локальным временем
const utcPlus6DateTime = new Date(currentTime.getTime() + 6 * 60 * 60 * 1000); // Добавляем 6 часов к UTC+0
return utcPlus6DateTime;
}
// Функция для обновления времени и даты на странице
function updateClock() {
const timeElement = document.getElementById('time');
if (timeElement) {
const currentDateTime = getCurrentDateTimeUTCPlus6();
const date = formatNumber(currentDateTime.getUTCDate());
const month = formatNumber(currentDateTime.getUTCMonth() + 1);
const year = currentDateTime.getUTCFullYear().toString().slice(-2); // Получаем последние две цифры года
const hours = formatNumber(currentDateTime.getUTCHours());
const minutes = formatNumber(currentDateTime.getUTCMinutes());
const seconds = formatNumber(currentDateTime.getUTCSeconds());
const dateTimeString = `${date}.${month}.${year} ${hours}:${minutes}:${seconds} UTC+6`;
timeElement.innerText = dateTimeString;
}
}
// Обновляем время и дату каждую секунду
setInterval(updateClock, 1000);
// Вызываем функцию для первоначального обновления времени и даты
updateClock();
</script>
<time style="color: var(--maincolor)" id="time">тут должно было быть время</time>