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