| |
| |
| |
| |
| @@ -326,6 +326,18 @@ def test_naturaldate_tz_aware() -> None: |
| assert humanize.naturaldate(future.astimezone(pdt)) == "today" |
| |
| |
| +def test_naturaldate_accepts_an_explicit_reference_day() -> None: |
| + reference = dt.date(2026, 1, 10) |
| + assert humanize.naturalday(dt.date(2026, 1, 11), when=reference) == "tomorrow" |
| + assert humanize.naturaldate(dt.date(2026, 1, 9), when=reference) == "yesterday" |
| + assert humanize.naturaldate(dt.date(2025, 7, 1), when=reference) == "Jul 01 2025" |
| + |
| + plus_fourteen = dt.timezone(dt.timedelta(hours=14)) |
| + value = dt.datetime(2026, 1, 1, 0, 30, tzinfo=plus_fourteen) |
| + instant = dt.datetime(2025, 12, 31, 12, 0, tzinfo=dt.timezone.utc) |
| + assert humanize.naturaldate(value, when=instant) == "today" |
| + |
| + |
| @pytest.mark.parametrize( |
| "seconds, expected", |
| [ |
|
|