:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(billing): default usage report date (#61098)
Marce Coll0678f2c517fa
diff --git a/posthog/management/commands/send_usage_report.py b/posthog/management/commands/send_usage_report.pyindex 1da9268f2dcd..fe9251e5fac4 100644--- a/posthog/management/commands/send_usage_report.py+++ b/posthog/management/commands/send_usage_report.py@@ -1,4 +1,5 @@from django.core.management.base import BaseCommand+from django.utils import timezonefrom posthog.tasks.usage_report import send_all_org_usage_reports@@ -23,7 +24,7 @@ class Command(BaseCommand):def handle(self, *args, **options):dry_run = options["dry_run"]- date = options["date"]+ date = options["date"] or timezone.now().date().isoformat()skip_capture_event = options["skip_capture_event"]run_async = options["async"]org_ids_str = options.get("org_ids")diff --git a/posthog/management/commands/test/test_send_usage_report.py b/posthog/management/commands/test/test_send_usage_report.pynew file mode 100644index 000000000000..5646d1aad3b3--- /dev/null+++ b/posthog/management/commands/test/test_send_usage_report.py@@ -0,0 +1,30 @@+from freezegun import freeze_time+from unittest.mock import patch++from django.core.management import call_command+++@freeze_time("2026-06-02T12:00:00Z")+def test_send_usage_report_defaults_to_current_date() -> None:+ with patch("posthog.management.commands.send_usage_report.send_all_org_usage_reports") as mock_send_reports:+ call_command("send_usage_report")++ mock_send_reports.assert_called_once_with(+ dry_run=None,+ at="2026-06-02",+ skip_capture_event=None,+ organization_ids=None,+ )+++@freeze_time("2026-06-02T12:00:00Z")+def test_send_usage_report_preserves_passed_date() -> None:+ with patch("posthog.management.commands.send_usage_report.send_all_org_usage_reports") as mock_send_reports:+ call_command("send_usage_report", "--date=2026-05-31")++ mock_send_reports.assert_called_once_with(+ dry_run=None,+ at="2026-05-31",+ skip_capture_event=None,+ organization_ids=None,+ )