Skip to content

Commit

Permalink
chore: minor timezone issue fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rajesh-jonnalagadda committed Sep 20, 2024
1 parent b4976ce commit 2c4c091
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions keep-ui/components/filters/GenericFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { GoPlusCircle } from "react-icons/go";
import { DateRangePicker, DateRangePickerValue, Title } from "@tremor/react";
import { MdOutlineDateRange } from "react-icons/md";
import { IconType } from "react-icons";
import { endOfDay } from "date-fns";


type Filter = {
key: string;
Expand Down Expand Up @@ -132,8 +134,12 @@ function CustomDate({
from: start,
to: end,
}: DateRangePickerValue) => {
setDateRange({ from: start ?? undefined, to: end ?? undefined });
handleDate(start, end);
const endDate = end || start;
const endOfDayDate = endDate ? endOfDay(endDate) : end;


setDateRange({ from: start ?? undefined, to: endOfDayDate ?? undefined });
handleDate(start, endOfDayDate);
};

useEffect(() => {
Expand Down Expand Up @@ -200,9 +206,7 @@ const PopoverContent: React.FC<PopoverContentProps> = ({
} else {
newValue = JSON.stringify({
start: start,
end: moment(end || start)
.endOf("day")
.toDate(),
end: end || start,
});
}
if (filter) {
Expand Down

0 comments on commit 2c4c091

Please sign in to comment.