From b6880b9b5ad52060d06ba2b19fbf945b266b4352 Mon Sep 17 00:00:00 2001 From: goodm2ice Date: Thu, 17 Mar 2022 06:42:15 +0500 Subject: [PATCH] =?UTF-8?q?=D0=B2=D0=BE=D0=B7=D0=B2=D1=80=D0=B0=D1=89?= =?UTF-8?q?=D0=B0=D0=B5=D0=BC=D0=BE=D0=B5=20=D0=B7=D0=BD=D0=B0=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20fractionalSum=20=D0=BF=D1=80=D0=B8=20?= =?UTF-8?q?=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B5=20=D0=B8=D0=B7=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=B5=D0=BD=D0=BE=20=D0=BD=D0=B0=20null?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/datetime.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/datetime.ts b/src/utils/datetime.ts index ff39581..4efcb56 100644 --- a/src/utils/datetime.ts +++ b/src/utils/datetime.ts @@ -45,8 +45,8 @@ export const calcDuration = (start: unknown, end: unknown) => { return (+new Date(end) - +new Date(start)) * timeInS.millisecond / timeInS.day } -export const fractionalSum = (date: unknown, value: number, type: keyof typeof timeInS): RawDate => { - if (!isRawDate(date) || !timeInS[type] || isNaN(value ?? NaN)) return NaN +export const fractionalSum = (date: unknown, value: number, type: keyof typeof timeInS): RawDate | null => { + if (!isRawDate(date) || !timeInS[type] || isNaN(value ?? NaN)) return null const d = new Date(date) d.setMilliseconds(d.getMilliseconds() + value * timeInS[type] * 1000) return d