Remove unused date range display logic
Eliminated calls and function for updating the date-range-display element, which does not exist in the DOM. This cleans up unnecessary JavaScript and prevents potential errors.
这个提交包含在:
父节点
a92d0976ca
当前提交
b03a16cbd0
共有 1 个文件被更改,包括 2 次插入 和 26 次删除
|
|
@ -315,32 +315,10 @@
|
||||||
<script>
|
<script>
|
||||||
// Enhanced JavaScript functionality for improved UX
|
// Enhanced JavaScript functionality for improved UX
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
updateDateRangeDisplay();
|
// Add event listeners for date changes - removed updateDateRangeDisplay calls
|
||||||
|
// since the date-range-display element doesn't exist
|
||||||
// Add event listeners for date changes
|
|
||||||
document.getElementById('from').addEventListener('change', updateDateRangeDisplay);
|
|
||||||
document.getElementById('to').addEventListener('change', updateDateRangeDisplay);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function updateDateRangeDisplay() {
|
|
||||||
const fromDate = document.getElementById('from').value;
|
|
||||||
const toDate = document.getElementById('to').value;
|
|
||||||
const display = document.getElementById('date-range-display');
|
|
||||||
|
|
||||||
// Only update if the display element exists
|
|
||||||
if (display) {
|
|
||||||
if (fromDate && toDate) {
|
|
||||||
if (fromDate === toDate) {
|
|
||||||
display.textContent = new Date(fromDate).toLocaleDateString();
|
|
||||||
} else {
|
|
||||||
display.textContent = new Date(fromDate).toLocaleDateString() + ' - ' + new Date(toDate).toLocaleDateString();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
display.textContent = 'Select dates';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setDateRange(period) {
|
function setDateRange(period) {
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
const fromInput = document.getElementById('from');
|
const fromInput = document.getElementById('from');
|
||||||
|
|
@ -377,7 +355,6 @@ function setDateRange(period) {
|
||||||
|
|
||||||
fromInput.value = formatDate(fromDate);
|
fromInput.value = formatDate(fromDate);
|
||||||
toInput.value = formatDate(today);
|
toInput.value = formatDate(today);
|
||||||
updateDateRangeDisplay();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -389,7 +366,6 @@ function clearFilters() {
|
||||||
const today = new Date().toISOString().split('T')[0];
|
const today = new Date().toISOString().split('T')[0];
|
||||||
document.getElementById('from').value = today;
|
document.getElementById('from').value = today;
|
||||||
document.getElementById('to').value = today;
|
document.getElementById('to').value = today;
|
||||||
updateDateRangeDisplay();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function exportMap() {
|
function exportMap() {
|
||||||
|
|
|
||||||
正在加载…
在新工单中引用