Fix timezone bug in event drag-and-drop causing 4-hour offset

Events dragged to 4am-7am were appearing at 8am-11am due to double
timezone conversion. The issue was:

1. Frontend converted local time to UTC before sending to backend
2. Backend (after previous fix) converted "local time" (actually UTC) to UTC again
3. Result: double conversion causing 4+ hour shift in wrong direction

Solution: Remove frontend UTC conversion in drag-and-drop callback.
Let backend handle the local-to-UTC conversion consistently.

- Remove .and_local_timezone(chrono::Local).unwrap().to_utc() conversion
- Send NaiveDateTime directly as local time strings to backend
- Backend parse_event_datetime() now properly handles local-to-UTC conversion

Now drag-and-drop works correctly: drag to 4am shows 4am.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Connor Johnstone
2025-09-03 16:21:24 -04:00
parent 0609a99839
commit 13a752a69c

View File

@@ -548,18 +548,11 @@ pub fn App() -> Html {
String::new() String::new()
}; };
// Convert local times to UTC for backend storage // Send local time directly to backend (backend will handle UTC conversion)
let start_utc = new_start let start_date = new_start.format("%Y-%m-%d").to_string();
.and_local_timezone(chrono::Local) let start_time = new_start.format("%H:%M").to_string();
.unwrap() let end_date = new_end.format("%Y-%m-%d").to_string();
.to_utc(); let end_time = new_end.format("%H:%M").to_string();
let end_utc = new_end.and_local_timezone(chrono::Local).unwrap().to_utc();
// Format UTC date and time strings for backend
let start_date = start_utc.format("%Y-%m-%d").to_string();
let start_time = start_utc.format("%H:%M").to_string();
let end_date = end_utc.format("%Y-%m-%d").to_string();
let end_time = end_utc.format("%H:%M").to_string();
// Convert existing event data to string formats for the API // Convert existing event data to string formats for the API
let status_str = match original_event.status { let status_str = match original_event.status {