From b578afbc6a2100a213e0319a9cace857761986ce Mon Sep 17 00:00:00 2001 From: Noah Alderton Date: Mon, 15 Jan 2024 16:35:48 -0800 Subject: [PATCH] fix: DatePicker Local Date (#2766) Fix DatePicker Local Date --- web/src/components/kit/DatePicker.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/src/components/kit/DatePicker.tsx b/web/src/components/kit/DatePicker.tsx index ce7dc025..f429e05c 100644 --- a/web/src/components/kit/DatePicker.tsx +++ b/web/src/components/kit/DatePicker.tsx @@ -4,7 +4,7 @@ import { useEffect, useRef, useState } from "react"; import useClickAway from "react-use/lib/useClickAway"; import { memoServiceClient } from "@/grpcweb"; import { DAILY_TIMESTAMP } from "@/helpers/consts"; -import { getDateStampByDate, isFutureDate } from "@/helpers/datetime"; +import { getDateStampByDate, getTimeStampByDate, isFutureDate } from "@/helpers/datetime"; import useCurrentUser from "@/hooks/useCurrentUser"; import { useTranslate } from "@/utils/i18n"; import Icon from "../Icon"; @@ -41,7 +41,8 @@ const DatePicker: React.FC = (props: DatePickerProps) => { }); const m = new Map(); Object.entries(memoCreationStats).forEach(([k]) => { - const date = getDateStampByDate(k); + const utcOffsetMilliseconds = new Date().getTimezoneOffset() * 60 * 1000; + const date = getDateStampByDate(new Date(getTimeStampByDate(k) + utcOffsetMilliseconds)); m.set(date, true); }); setCountByDate(m);