← datediff operator page · time/datediff/sc_date/across_the_new_year

Across the new year 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

datediff(SC_1, SC_2) of two scalar dates, SC_1 = 2020-12-14 and SC_2 = 2021-04-20, the page's valid syntax datediff (2020-12-14,2021-04-20), with the dates given in the default YYYY-MM-DD form, as VTL has no date literal.

Manual:

Days between two dates: "The operator datediff returns the number of days between two dates or time periods."

Expected:

DS_r = 127, an Integer: 17 days to the end of 2020, then 31, 28 (2021 is not a leap year), 31 and 20.

script.vtl ⇩

DS_r := datediff(SC_1, SC_2);

input/scalars.csv ⇩

SC_1SC_2
2020-12-142021-04-20

input/scalars.json ⇩

{
  "scalars": [
    {"name": "SC_1", "type": "Date"},
    {"name": "SC_2", "type": "Date"}
  ]
}

expected/scalars.json ⇩

{
  "scalars": [
    {"name": "DS_r", "type": "Integer", "value": 127}
  ]
}