Skip to content

0.5 values in date durations are considered valid but interpreted as 1 #27

@dantman

Description

@dantman

When 0.5 is used in a value, it ends up as 0.5 in the DateDuration but appears to actually increment a datetime by 1. This behaviour also seems to apply to YMD and HMS but W seems to work in an incomplete way.

from datetime import datetime
from isoduration import parse_duration
datetime(2023, 1, 1) + parse_duration('P0.5M')
# datetime.datetime(2023, 2, 1, 0, 0)
parse_duration('P0.5M')
# Duration(DateDuration(years=Decimal('0'), months=Decimal('0.5'), days=Decimal('0'), weeks=Decimal('0')), TimeDuration(hours=Decimal('0'), minutes=Decimal('0'), seconds=Decimal('0')))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions