@@ -37,6 +37,10 @@
|
||||
-moz-appearance: textfield;
|
||||
appearance: textfield;
|
||||
}
|
||||
/* Принудительное отображение 24-часового формата */
|
||||
input[type="datetime-local"] {
|
||||
font-family: monospace;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -143,14 +147,14 @@
|
||||
<div class="col-md-2">
|
||||
<label for="vk_post_url" class="form-label">Пост в ВК:</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-4">
|
||||
<input type="url" class="form-control" id="vk_post_url">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label for="published_at" class="form-label">датирован:</label>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<input type="datetime-local" class="form-control" id="published_at">
|
||||
<div class="col-md-4">
|
||||
<input type="datetime-local" class="form-control" id="published_at" step="60">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -160,7 +164,7 @@
|
||||
<label for="tg_publication_date" class="form-label">Опубликовано в TG:</label>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<input type="datetime-local" class="form-control" id="tg_publication_date">
|
||||
<input type="datetime-local" class="form-control" id="tg_publication_date" step="60">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -209,7 +213,7 @@
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="poll_end_date" class="form-label">Дата окончания опроса</label>
|
||||
<input type="datetime-local" class="form-control" id="poll_end_date">
|
||||
<input type="datetime-local" class="form-control" id="poll_end_date" step="60">
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user