class augur.dates.ambiguous_date.AmbiguousDate(uncertain_date, fmt='%Y-%m-%d')

Bases: object

Transforms a date string with uncertainty into the range of possible dates.


Raise an exception if a constrained digit appears in a less-significant place than an uncertain digit.

Assuming %Y-%m-%d, these patterns are valid:

2000-01-01 2000-01-XX 2000-XX-XX

but this is invalid, because month is uncertain but day is constrained:


These invalid cases are assumed to be unintended use of the tool.

property fmt_components

Return the range of possible dates defined by the ambiguous date.

Impose an upper limit of today’s date.

property regex

Returns regex defined by the format string. Currently only supports %Y, %m, and %d.

property uncertain_date_components

Get exact date bounds based on given years.

augur.dates.ambiguous_date.max_day_for_year_month(year, month)
augur.dates.ambiguous_date.resolve_uncertain_int(uncertain_string, min_or_max)

Takes a string representation of an integer with uncertain places occupied by the character X. Returns the minimum or maximum possible integer.

augur.dates.ambiguous_date.tuple_to_date(year, month, day)