diff --git a/augur/dates/ambiguous_date.py b/augur/dates/ambiguous_date.py index dd372bc9b..965400627 100644 --- a/augur/dates/ambiguous_date.py +++ b/augur/dates/ambiguous_date.py @@ -65,7 +65,8 @@ def range(self): resolve_uncertain_int(self.uncertain_date_components["d"], "max"), ) - # Limit the max date to be no later than today's date. + # Limit the min and max dates to be no later than today's date. + min_date = min(min_date, datetime.date.today()) max_date = min(max_date, datetime.date.today()) return (min_date, max_date) diff --git a/tests/dates/test_dates.py b/tests/dates/test_dates.py index 2e767dfaf..1427ea3fa 100644 --- a/tests/dates/test_dates.py +++ b/tests/dates/test_dates.py @@ -51,10 +51,9 @@ def test_get_numerical_date_from_value_ambiguous_month_and_day(self): @freeze_time("2000-02-20") def test_get_numerical_date_from_value_current_day_limit(self): min_date, max_date = dates.get_numerical_date_from_value("2000-03-XX", "%Y-%m-%d") - # min_date is not subject to the upper limit assert (min_date - == pytest.approx(dates.numeric_date(datetime.date(year=2000, month=3, day=1)), abs=1e-3) - == pytest.approx(2000.165, abs=1e-3) + == pytest.approx(dates.numeric_date(datetime.date(year=2000, month=2, day=20)), abs=1e-3) + == pytest.approx(2000.138, abs=1e-3) ) assert (max_date == pytest.approx(dates.numeric_date(datetime.date(year=2000, month=2, day=20)), abs=1e-3)