File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
packages/react-notion-x/src/third-party Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -361,26 +361,28 @@ 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 (
373- intervalToDuration ( {
374- start : date2 ,
375- end : date1
376- } ) as any
377- ) [ unit ] as number
373+ (
374+ intervalToDuration ( {
375+ start : date2 ,
376+ end : date1
377+ } ) as any
378+ ) [ unit ] ?? 0
379+ )
378380 }
379381
380382 case 'dateSubtract' : {
381383 const date = evalFormula ( args [ 0 ] ! , ctx ) as Date
382384 const number = evalFormula ( args [ 1 ] ! , ctx ) as number
383- const unit = evalFormula ( args [ 1 ] ! , ctx ) as string
385+ const unit = evalFormula ( args [ 2 ] ! , ctx ) as string
384386 return sub ( date , { [ unit ] : number } )
385387 }
386388
You can’t perform that action at this time.
0 commit comments