metomi/isodatetime

Day of the month inconsistency with truncated time points

oliver-sanders opened this issue · 4 comments

When adding a truncated TimePoint to a regular TimePoint there can be inconsistencies with the day of the month.

e.g: 2000-01-01T00:00:00Z + 03-30T00:00:00Z = 2000-03-02T00:00:00Z

Reported in cylc/cylc-flow#2382

kinow commented

NOTE: See closed/archived (not-merged) PR #101 for some related comments and cases for tests.

Just to check, the correct behaviour should be:

2000-01-01T00Z + 03-30T00Z = 2000-03-30T00Z?

kinow commented

Just to check, the correct behaviour should be:

2000-01-01T00Z + 03-30T00Z = 2000-03-30T00Z?

That was my understanding @MetRonnie 👍

See also this example from cylc/cylc-flow#4805 (comment)

>>> now = TimePointParser().parse("2010-08-08T15:40Z")
>>> point = TimePointParser(allow_truncated=True).parse("-10")
>>> now + point
<metomi.isodatetime.data.TimePoint: 2010-08-08T15:40:00Z>
>>> now == now + point
True

I think now + point ought to equal 2110-08-08T15:40:00Z.