woob.tools.date
¶
-
class
woob.tools.date.
LinearDateGuesser
(current_date=None, date_max_bump=datetime.timedelta(days=31))¶ 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.
-
guess_date
(day, month, change_current_date=True)¶ Returns a date object built from a given day/month pair.
-
set_current_date
(current_date)¶
-
try_assigning_year
(day, month, start_year, max_year)¶ 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.
-
-
woob.tools.date.
closest_date
(date, date_from, date_to)¶ Adjusts year so that the date is closest to the given range. Transactions dates in a statement usually contain only day and month. Statement dates range have a year though. Merge them all together to get a full transaction date.
-
class
woob.tools.date.
date
¶ Bases:
datetime.date
-
classmethod
from_date
(d)¶
-
strftime
(fmt)¶ format -> strftime() style string.
-
classmethod
-
class
woob.tools.date.
datetime
¶ Bases:
datetime.datetime
-
combine
(date, time)¶ date, time -> datetime with same date and time fields
-
date
()¶ Return date object with same year, month and day.
-
classmethod
from_datetime
(dt)¶
-
strftime
(fmt)¶ format -> strftime() style string.
-
-
woob.tools.date.
local2utc
(dateobj)¶
-
woob.tools.date.
new_date
(d)¶ Generate a safe date from a datetime.date object
-
woob.tools.date.
new_datetime
(d)¶ Generate a safe datetime from a datetime.date or datetime.datetime object
-
woob.tools.date.
now_as_tz
(tzinfo)¶
-
woob.tools.date.
now_as_utc
()¶
-
woob.tools.date.
utc2local
(dateobj)¶