← daytoyear operator page · time/daytoyear/sc/years_of_365_days

Years of 365 days 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

daytoyear(SC_1) with SC_1 = 782, the page's Example 2.

Manual:

Number days to duration: daytoyear (782); "returns P2Y52D"; daytoyear "returns a duration having the following mask", \PY\YDDD\D, "the corresponding number of years and days; according to ISO 8601 Y = 365D".

Expected:

DS_r = P2Y52D, a String: 782 = 2 × 365 + 52.

Team decision:

#394: a Duration holds only a period indicator (A, S, Q, M, W, D), so the ISO 8601 durations that daytoyear and daytomonth return and yeartoday and monthtoday take are Strings.

script.vtl ⇩

DS_r := daytoyear(SC_1);

input/scalars.csv ⇩

SC_1
782

input/scalars.json ⇩

{
  "scalars": [
    {"name": "SC_1", "type": "Integer"}
  ]
}

expected/scalars.json ⇩

{
  "scalars": [
    {"name": "DS_r", "type": "String", "value": "P2Y52D"}
  ]
}