woob.tools.date
¶
- class LinearDateGuesser(current_date=None, date_max_bump=timedelta(31))[source]¶
Bases:
object
The aim of this class is to guess the exact date object from a day and a month, but not a year.
It works with a start date (default is today), and all dates must be sorted from recent to older.
- try_assigning_year(day, month, start_year, max_year)[source]¶
Tries to create a date object with day, month and start_year and returns it. If it fails due to the year not matching the day+month combination (i.e. due to a ValueError – TypeError and OverflowError are not handled), the previous or next years are tried until max_year is reached. In case initialization still fails with max_year, this function raises a ValueError.