From ce6e3c333a872523ad5a35f676c0a72bc4e8b51b Mon Sep 17 00:00:00 2001 From: Maciej Gierada Date: Sun, 16 Jun 2024 19:50:33 +0200 Subject: [PATCH] fix: bug that always display data range since the same date --- ui/src/components/Callendar/index.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ui/src/components/Callendar/index.jsx b/ui/src/components/Callendar/index.jsx index 385de9c..177cab1 100644 --- a/ui/src/components/Callendar/index.jsx +++ b/ui/src/components/Callendar/index.jsx @@ -14,9 +14,12 @@ import { } from "@/components/ui/popover"; const Callendar = ({ className, lastTimeReseted, currentCouterValue }) => { + const fromDate = lastTimeReseted + ? new Date(lastTimeReseted) + : new Date(2024, 4, 13); const [date, setDate] = React.useState({ - from: lastTimeReseted ? new Date(lastTimeReseted) : new Date(2024, 4, 13), - to: addDays(new Date(2024, 4, 13), currentCouterValue), + from: fromDate, + to: addDays(fromDate, currentCouterValue), }); return (