← monthtoday operator page · time/monthtoday/comp/iso_month_and_day_durations

Iso month and day durations 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

monthtoday(Me_1) inside calc, on durations written as the manual writes them, P2M5D, P12M0D and P0M15D, in a String Me_1.

Manual:

Duration to number days: monthDuration is "a duration having the following mask", \PM\MDD\D, and the days are counted "according to ISO 8601 M = 30D", as in Example 3, where monthtoday (P3M10D); "returns 100".

Expected:

Me_2 is 65 (2 × 30 + 5), 360 (12 × 30) and 15, Integers.

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 := DS_1[calc Me_2 := monthtoday(Me_1)];

input/DS_1.csv ⇩

Id_1Me_1
GP2M5D
HP12M0D
TP0M15D

input/DS_1.json ⇩

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

expected/DS_r.csv ⇩

Id_1Me_1Me_2
GP2M5D65
HP12M0D360
TP0M15D15

expected/DS_r.json ⇩

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