File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
packages/react-notion-x/src/third-party Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -361,26 +361,26 @@ function evalFunctionFormula(
361361 case 'dateAdd' : {
362362 const date = evalFormula ( args [ 0 ] ! , ctx ) as Date
363363 const number = evalFormula ( args [ 1 ] ! , ctx ) as number
364- const unit = evalFormula ( args [ 1 ] ! , ctx ) as string
364+ const unit = evalFormula ( args [ 2 ] ! , ctx ) as string
365365 return add ( date , { [ unit ] : number } )
366366 }
367367
368368 case 'dateBetween' : {
369369 const date1 = evalFormula ( args [ 0 ] ! , ctx ) as Date
370370 const date2 = evalFormula ( args [ 1 ] ! , ctx ) as Date
371- const unit = evalFormula ( args [ 1 ] ! , ctx ) as string
371+ const unit = evalFormula ( args [ 2 ] ! , ctx ) as string
372372 return (
373373 intervalToDuration ( {
374374 start : date2 ,
375375 end : date1
376376 } ) as any
377- ) [ unit ] as number
377+ ) [ unit ] ?? 0 as number
378378 }
379379
380380 case 'dateSubtract' : {
381381 const date = evalFormula ( args [ 0 ] ! , ctx ) as Date
382382 const number = evalFormula ( args [ 1 ] ! , ctx ) as number
383- const unit = evalFormula ( args [ 1 ] ! , ctx ) as string
383+ const unit = evalFormula ( args [ 2 ] ! , ctx ) as string
384384 return sub ( date , { [ unit ] : number } )
385385 }
386386
You can’t perform that action at this time.
0 commit comments