Skip to content

Commit c166e75

Browse files
mjunaidcaclaude
andcommitted
fix(notifications): Fix timezone and async bugs for reminders
1. Frontend: Convert datetime-local to UTC before sending to API - datetime-local returns local time without timezone - Now converts to ISO string with UTC timezone 2. Notification service: Add session.refresh() after commit - Fixes SQLAlchemy greenlet error when accessing notification.id - Error was: 'greenlet_spawn has not been called' 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 7bd3bb4 commit c166e75

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

  • apps
    • notification-service/src/notification_service/routers
    • web/src/app/projects/[id]/tasks/new

apps/notification-service/src/notification_service/routers/dapr.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ async def handle_task_events(
7171
if notification:
7272
session.add(notification)
7373
await session.commit()
74+
await session.refresh(notification) # Refresh to get ID without lazy load
7475
logger.info("[DAPR] Created notification %d for %s", notification.id, notification.user_id)
7576

7677
return {"status": "SUCCESS"}

apps/web/src/app/projects/[id]/tasks/new/page.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,20 @@ export default function NewTaskPage() {
101101

102102
try {
103103
setSubmitting(true)
104+
// Convert local datetime to UTC ISO string for the API
105+
// datetime-local gives us "2025-12-15T23:13" in local time
106+
// We need to send it as UTC: "2025-12-15T18:13:00Z" (for UTC+5)
107+
let dueDateUTC: string | undefined = undefined
108+
if (dueDate) {
109+
const localDate = new Date(dueDate)
110+
dueDateUTC = localDate.toISOString()
111+
}
104112
const task = await api.createTask(selectedProjectId, {
105113
title: title.trim(),
106114
description: description.trim() || undefined,
107115
priority,
108116
assignee_id: assigneeId && assigneeId !== "unassigned" ? Number(assigneeId) : undefined,
109-
due_date: dueDate || undefined,
117+
due_date: dueDateUTC,
110118
// Recurring fields
111119
is_recurring: isRecurring,
112120
recurrence_pattern: isRecurring && recurrencePattern ? recurrencePattern : undefined,

0 commit comments

Comments
 (0)