diff --git a/modules/bar/popouts/Calendar.qml b/modules/bar/popouts/Calendar.qml index 097f0bd..40d2a8d 100644 --- a/modules/bar/popouts/Calendar.qml +++ b/modules/bar/popouts/Calendar.qml @@ -24,12 +24,6 @@ Column { if (!root.selectedStartDate) return if (root.selectedStartDate && root.selectedEndDate) { - // For range selection, just count the days between dates - const start = new Date(root.selectedStartDate.getFullYear(), root.selectedStartDate.getMonth(), root.selectedStartDate.getDate()) - const end = new Date(root.selectedEndDate.getFullYear(), root.selectedEndDate.getMonth(), root.selectedEndDate.getDate()) - const diffDays = Math.round((end - start) / (1000 * 60 * 60 * 24)) - root.dateCalculation = Math.abs(diffDays) + " days" - } else { // For single date selection, compare with today const today = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()) const selected = new Date(root.selectedStartDate.getFullYear(), root.selectedStartDate.getMonth(), root.selectedStartDate.getDate()) @@ -45,22 +39,6 @@ Column { } } - function calculateDaysFromReference(referenceDate, targetDate) { - if (!referenceDate || !targetDate) return - - const ref = new Date(referenceDate.getFullYear(), referenceDate.getMonth(), referenceDate.getDate()) - const target = new Date(targetDate.getFullYear(), targetDate.getMonth(), targetDate.getDate()) - const diffDays = Math.round((target - ref) / (1000 * 60 * 60 * 24)) - - if (diffDays === 0) { - root.dateCalculation = "0 days" - } else if (diffDays > 0) { - root.dateCalculation = diffDays + " days until" - } else { - root.dateCalculation = Math.abs(diffDays) + " days since" - } - } - function resetSelection() { root.selectedStartDate = new Date() root.selectedEndDate = new Date() @@ -380,7 +358,7 @@ Column { if (root.selectedStartDate) { root.selectedEndDate = modelData.date root.hasSelection = true - root.calculateDaysFromReference(root.selectedStartDate, modelData.date) + root.calculateDays() } } }