dh-tech / undate-python

A Python library for working with fuzzy, partial, or otherwise uncertain dates
Apache License 2.0
6 stars 1 forks source link

handle dates with missing information, e.g. due to corrupted or missing text #64

Open rlskoeser opened 8 months ago

rlskoeser commented 8 months ago

comment referencing these lines in the tests:

  # should we infer unknown month? or raise an exception?
  # assert str(Undate(2022, day="2X")) == "2022-XX-2X"  # currently returns 2022-2X
  # assert str(Undate(2022, day=7)) == "2022-XX-07"   @ currently returns 2022-07

I could see a situation with a corrupted text where we legitimately only know the year and day of the month, but we can't do much with the additional day info in this case. I don't think it should error; it's also unlikely we can infer the month in this situation. Is it possible to bump to the known granularity (year) for calculation purposes, and leave the day in a string rendering of the undate?

_Originally posted by @ColeDCrawford in https://github.com/dh-tech/undate-python/pull/36#discussion_r1367508231_

questions: