|
|
@ -130,7 +130,10 @@ const sqlite3 = { |
|
|
|
sql = `(strftime('%Y', ${datetime_expr1}) - strftime('%Y', ${datetime_expr2})) * 4 + (strftime('%m', ${datetime_expr1}) - strftime('%m', ${datetime_expr2})) / 3`; |
|
|
|
sql = `(strftime('%Y', ${datetime_expr1}) - strftime('%Y', ${datetime_expr2})) * 4 + (strftime('%m', ${datetime_expr1}) - strftime('%m', ${datetime_expr2})) / 3`; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'years': |
|
|
|
case 'years': |
|
|
|
sql = `strftime('%Y', ${datetime_expr1}) - strftime('%Y', ${datetime_expr2})`; |
|
|
|
sql = `CASE
|
|
|
|
|
|
|
|
WHEN (JULIANDAY(${datetime_expr1}) - JULIANDAY(${datetime_expr2})) >= 0 THEN FLOOR(((JULIANDAY(${datetime_expr1}) - JULIANDAY(${datetime_expr2})) / 365.25)) |
|
|
|
|
|
|
|
ELSE CEILING(((JULIANDAY(${datetime_expr1}) - JULIANDAY(${datetime_expr2})) / 365.25)) |
|
|
|
|
|
|
|
END`;
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'days': |
|
|
|
case 'days': |
|
|
|
sql = `JULIANDAY(${datetime_expr1}) - JULIANDAY(${datetime_expr2})`; |
|
|
|
sql = `JULIANDAY(${datetime_expr1}) - JULIANDAY(${datetime_expr2})`; |
|
|
|