Skip to content

Problem with description of Casting with optional mask from string to Time_Period/Duration and Time_Period/Duration to string #671

@javihern98

Description

@javihern98

Overview

Looking at the 2.2 spec, there seems to be some inconsistencies with the usual way of handling time formats:

Cast from String with optional mask

  • Duration: ISO-8601 durations (P...) or shorthand (A, S, Q, M, W, D)
    • Example: "P1Y" → 1 year, "P3M" → 3 months, "A" → 1 year (annual), "Q" → 1 quarter
    • VTL 2.2 Spec:

      If the input string starts with P, the entire string is consumed and parsed, according to the ISO-8601 standard for durations up to a precision of days, and the corresponding duration value is returned. Otherwise, one of A, S, Q, M, W or D is consumed, and a duration value is returned representing the duration respectively of a year, a half of a year, a quarter of a year, a month, a week and a day.

Cast to String with optional mask

  • Time Period: ISO-8601 time interval format start/end (day precision)

    • Format: YYYY-MM-DD/YYYY-MM-DD
    • Example: 2024-01-01/2024-12-31 (annual), 2024-01-01/2024-03-31 (quarterly)
    • Note: Represents the full period inclusively
    • VTL 2.2 Spec:

      the time_period value is printed using the ISO-8601 representation for generic time intervals, up to a precision of days, in the form start/end.

  • Duration: ISO-8601 duration format starting with P

    • Format: P[n]Y[n]M[n]W[n]DT[n]H[n]M[n]S (only relevant fields included)
    • Example: P1Y (1 year), P3M (3 months), P7D (7 days), PT2H30M (2.5 hours)
    • VTL spec limits precision to days, so time components (hours/minutes/seconds) may not be used
    • VTL 2.2 Spec:

      the duration value is printed using the ISO-8601 representation for durations.

To review

  • Explain why TimePeriod is written as a date interval with day precision, instead of the usual format (like 2020Q2)
  • Normalisation of the use of hyphen or not in the Time_Period representation (whether to always use 2020-Q2 or 2020Q2 or 2020 instead of 2020A. We really need to be consistent in the whole manual with this
  • Explain why Duration has in the to string as the ISO 8601 but the from string also includes the shorthand, we should always use ISO 8601 IMHO

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions