Skip to content

DateTime(2018, 5, 23) add/subtract weeks returns the wrong value #883

@bryantaustin13

Description

@bryantaustin13

Demonstrated in cql-tests CqlDateTimeOperatorsTest.xml:: DateTimeAddYearInWeeks

Engine evaluates DateTime(2018, 5, 23) + 52 weeks to be "@2019-05-23T". It should evaluate to "@2019-05-22T"
52 weeks = 364 days
Adding 364 days to 2018-05-23 (2018 is not a leap year) lands one day before the same calendar date the next year

These 2 tests also fail for the same error:
DateTimeLeapDayAddYearInWeeks. DateTime(2023, 3, 2) + 52 weeks
DateTimeLeapYearAddYearInWeeks. DateTime(2024, 2, 28) + 52 weeks
DateTimeSubtractYearInWeeks. DateTime(2018, 5, 23) - 52 weeks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions