When you add a conjugate Duration such as P1M1D to a TimePoint, it seems isodatetime does + P1D + P1M internally, which I think is confusing.
This can be argued either way (I don't think ISO 8601 specifies what order is supposed to happen), but I think the order should be as is written from left to right, i.e. + P1M + P1D.
Why does the order matter, you ask? For nominal (inexact) units, addition is not associative:
(I've used shorthand to represent the metomi.isodatetime.data objects)
The other side of the argument is that we should stick with the existing behaviour to avoid a breaking, possibly-painful change.
Note: If users want the addition to take place in a specific order, they should use separate Duration objects and add them to the TimePoint object in the desired order, not add Duration objects together.
From https://github.com/cylc/cylc-flow/issues/4908
When you add a conjugate Duration such as
P1M1D
to a TimePoint, it seems isodatetime does+ P1D + P1M
internally, which I think is confusing.This can be argued either way (I don't think ISO 8601 specifies what order is supposed to happen), but I think the order should be as is written from left to right, i.e.
+ P1M + P1D
.Why does the order matter, you ask? For nominal (inexact) units, addition is not associative:
(I've used shorthand to represent the
metomi.isodatetime.data
objects)The other side of the argument is that we should stick with the existing behaviour to avoid a breaking, possibly-painful change.
Note: If users want the addition to take place in a specific order, they should use separate Duration objects and add them to the TimePoint object in the desired order, not add Duration objects together.