Initial commit

This commit is contained in:
ai_ml_operations
2026-08-27 04:17:34 -07:00
commit 3a14bfb996
297 changed files with 32710 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
"""Shared schedule parsing for campaigns and social posts."""
from datetime import datetime
from django.utils import timezone
def parse_scheduled_for(raw: str | None):
"""Parse optional ``datetime-local`` value into an aware datetime."""
value = (raw or "").strip()
if not value:
return None
try:
parsed = datetime.fromisoformat(value)
except ValueError as exc:
raise ValueError("Invalid schedule datetime.") from exc
if timezone.is_naive(parsed):
return timezone.make_aware(parsed, timezone.get_current_timezone())
return parsed