Skip to content

Unexpected result when comparing PartialDate objects with different precision  #11

@shutterfreak

Description

@shutterfreak

When using PartialDate objects having different precision to define a (partial) date range, the dates are always computed from the 1st of the (month/year) of either PartialDate object, which is not necessarily correct.

Example:

>>> from partial_date import PartialDate

>>> date_from = PartialDate("2000-05")
>>> date_until = PartialDate("2000")

>>> date_from
2000-05
>>> date_from.precision
1

>>> date_until
2000
>>> date_until.precision
0

>>> date_from < date_until
False
>>> date_from > date_until
True

In this case, either cases should be true because of the lower date accuracy (precision) of date_until:

  • date_from < date_until
  • date_from > date_until

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