isodatetime icon indicating copy to clipboard operation
isodatetime copied to clipboard

Day of the month inconsistency with truncated time points

Open oliver-sanders opened this issue 8 years ago • 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 https://github.com/cylc/cylc/issues/2382

oliver-sanders avatar Aug 17 '17 11:08 oliver-sanders

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

kinow avatar Jun 20 '19 11:06 kinow

Just to check, the correct behaviour should be:

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

MetRonnie avatar Jun 15 '20 11:06 MetRonnie

Just to check, the correct behaviour should be:

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

That was my understanding @MetRonnie :+1:

kinow avatar Jun 16 '20 02:06 kinow

See also this example from https://github.com/cylc/cylc-flow/issues/4805#issuecomment-1103928604

>>> 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.

MetRonnie avatar May 03 '22 12:05 MetRonnie