From fcd8447658c45a90ed455ebff78df3113b9730e8 Mon Sep 17 00:00:00 2001 From: inportb Date: Thu, 2 Jan 2025 22:52:19 -0500 Subject: [PATCH] Fix date range negative month --- htdocs/DateRangePicker.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/DateRangePicker.vue b/htdocs/DateRangePicker.vue index 5a3763b..71e130c 100644 --- a/htdocs/DateRangePicker.vue +++ b/htdocs/DateRangePicker.vue @@ -53,8 +53,8 @@ } function timeshift_month(date, diff) { - var month = date.getMonth() + diff; - return new Date(date.getFullYear() + Math.floor(month/12), month >= 0 ? (month%12) : (month%12 + 12), date.getDate()); + var month = date.getMonth() + diff, month_mod12 = month%12; + return new Date(date.getFullYear() + Math.floor(month/12), month_mod12 >= 0 ? (month_mod12) : (month_mod12 + 12), date.getDate()); } function datecalc(date, range, direction) {