From 9f21d08dcdcaddb95688dfe0e82d384891c31a9d Mon Sep 17 00:00:00 2001 From: CounterFire2023 <136581895+CounterFire2023@users.noreply.github.com> Date: Thu, 11 Apr 2024 12:03:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9utc=20=E6=A1=A3=E6=9C=9F?= =?UTF-8?q?=E5=BC=80=E5=A7=8B=E7=9A=84=E8=AE=A1=E7=AE=97=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/utcdate.util.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/utils/utcdate.util.ts b/src/utils/utcdate.util.ts index 341fab2..a232d2a 100644 --- a/src/utils/utcdate.util.ts +++ b/src/utils/utcdate.util.ts @@ -31,10 +31,9 @@ export function daysBetween(date1: Date, date2: Date) { // get begin of one day export const getDayBegin = (date: Date): Date => { - const year = date.getUTCFullYear() - const month = date.getUTCMonth() - const day = date.getUTCDate() - return new Date(year, month, day) + let result = new Date(date.getTime()) + result.setUTCHours(0, 0, 0, 0) + return result } // get begin of n day ago