Class ItuDurationParser


  • public class ItuDurationParser
    extends java.lang.Object
    Rationale Against Supporting Years and Months

    Supporting years (Y) and months (M) in duration calculations is problematic due to:

    Variable Lengths: Months have different lengths (28-31 days), and years may be leap or non-leap (365 vs. 366 days). This makes durations ambiguous unless referenced to a specific start date.

    Context-Dependent Interpretation: P1M could mean 28, 29, 30, or 31 days depending on the month in which it is applied.

    Difficult Arithmetic: Operations like addition and comparison require anchoring to a specific date, making them non-trivial in purely arithmetic computations.

    Consistency Issues: Excluding years and months ensures durations are always exact and unambiguous, aligning with precise time-based measurements.