Try this in cell M1

Formula: copy to clipboard
=IF(AND(I1=0,J1=0),TODAY()-H1,IF(AND(I1=0,J1>0),TODAY()-J1,IF(AND(I1>0,J1>0),I1-J1,IF(AND(I1>0,J1=0),I1-H1,0))))