forked from ddrilling/asb_cloud_front
возвращаемое значение fractionalSum при ошибке изменено на null
This commit is contained in:
parent
2384f65999
commit
b6880b9b5a
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user