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
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
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
P...) or shorthand (A,S,Q,M,W,D)"P1Y"→ 1 year,"P3M"→ 3 months,"A"→ 1 year (annual),"Q"→ 1 quarterCast to String with optional mask
Time Period: ISO-8601 time interval format
start/end(day precision)YYYY-MM-DD/YYYY-MM-DD2024-01-01/2024-12-31(annual),2024-01-01/2024-03-31(quarterly)Duration: ISO-8601 duration format starting with
PP[n]Y[n]M[n]W[n]DT[n]H[n]M[n]S(only relevant fields included)P1Y(1 year),P3M(3 months),P7D(7 days),PT2H30M(2.5 hours)To review
2020Q2)2020-Q2or2020Q2or2020instead of2020A. We really need to be consistent in the whole manual with this