← dayofmonth operator page · time/dayofmonth/comp/leap_day_and_month_end

Leap day and month end 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

dayofmonth(Me_1) inside calc, on a date in the middle of a month, the leap day of 2020 and the last day of a month.

Manual:

Extract time period: "The operator dayofmonth returns the ordinal day within the month (between 1 and 31)."

Expected:

Me_2 is 15, 29 and 31, Integers.

script.vtl ⇩

DS_r := DS_1[calc Me_2 := dayofmonth(Me_1)];

input/DS_1.csv ⇩

Id_1Me_1
G2019-01-15
H2020-02-29
T2020-12-31

input/DS_1.json ⇩

{
  "datasets": [
    {
      "name": "DS_1",
      "DataStructure": [
        {"name": "Id_1", "type": "String", "role": "Identifier", "nullable": false},
        {"name": "Me_1", "type": "Date", "role": "Measure", "nullable": true}
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1Me_1Me_2
G2019-01-1515
H2020-02-2929
T2020-12-3131

expected/DS_r.json ⇩

{
  "datasets": [
    {
      "name": "DS_r",
      "DataStructure": [
        {"name": "Id_1", "type": "String", "role": "Identifier"},
        {"name": "Me_1", "type": "Date", "role": "Measure"},
        {"name": "Me_2", "type": "Integer", "role": "Measure"}
      ]
    }
  ]
}