diff --git a/templates/edit_post.html b/templates/edit_post.html index 26259e6..3b3eb62 100644 --- a/templates/edit_post.html +++ b/templates/edit_post.html @@ -37,6 +37,10 @@ -moz-appearance: textfield; appearance: textfield; } + /* Принудительное отображение 24-часового формата */ + input[type="datetime-local"] { + font-family: monospace; + } @@ -143,14 +147,14 @@
-
+
-
- +
+
@@ -160,7 +164,7 @@
- +
@@ -209,7 +213,7 @@
- +
@@ -313,6 +317,27 @@ loadPostData(postId); } + // Принудительная установка 24-часового формата для полей даты-времени + const datetimeInputs = document.querySelectorAll('input[type="datetime-local"]'); + datetimeInputs.forEach(input => { + // Устанавливаем атрибут step для округления до минут + input.step = '60'; + + // Добавляем обработчик для принудительного отображения 24-часового формата + input.addEventListener('change', function() { + if (this.value) { + const date = new Date(this.value); + // Форматируем в 24-часовом формате + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + const hours = String(date.getHours()).padStart(2, '0'); + const minutes = String(date.getMinutes()).padStart(2, '0'); + this.value = `${year}-${month}-${day}T${hours}:${minutes}`; + } + }); + }); + // Обработка отправки формы form.addEventListener('submit', (e) => { e.preventDefault();