summaryrefslogtreecommitdiff
path: root/issues/010-fix-quick-add-timestamp.md
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-01-22 10:09:07 -1000
committerPeter Stone <thepeterstone@gmail.com>2026-01-22 10:09:07 -1000
commit7fd381a242f68b7c6f10db4e3ae0bb3d06e36a16 (patch)
treeabff0af0a0f3b057d7b1ad6d95dbefdf30c553c3 /issues/010-fix-quick-add-timestamp.md
parent583f90c5dedf0235fa45557359b0e6e7dd62b0f0 (diff)
Fix background image CORS issue
Switch from Unsplash Source API to Lorem Picsum which has proper CORS headers for cross-origin image loading. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'issues/010-fix-quick-add-timestamp.md')
-rw-r--r--issues/010-fix-quick-add-timestamp.md76
1 files changed, 76 insertions, 0 deletions
diff --git a/issues/010-fix-quick-add-timestamp.md b/issues/010-fix-quick-add-timestamp.md
new file mode 100644
index 0000000..3c59325
--- /dev/null
+++ b/issues/010-fix-quick-add-timestamp.md
@@ -0,0 +1,76 @@
+# [BUG] Quick add date defaults to tomorrow in evening
+
+## Description
+The date pre-filled in quick add defaults to tomorrow when used during the evening.
+
+## Symptom
+When adding a task in the evening, the date field pre-fills with tomorrow's date instead of today.
+
+## Technical Context
+- Likely a timezone or date boundary issue
+- Server may be using UTC while user expects local time
+- Or JavaScript date handling crossing midnight boundary incorrectly
+
+## Test Strategy
+
+### Unit Test (Red)
+**File:** `internal/handlers/handlers_test.go`
+
+```go
+func TestQuickAddDefaultDate(t *testing.T) {
+ tests := []struct {
+ name string
+ serverTime time.Time
+ userTZ string
+ expectedDate string
+ }{
+ {
+ name: "evening in US Eastern",
+ serverTime: time.Date(2026, 1, 21, 23, 0, 0, 0, time.UTC), // 6pm ET
+ userTZ: "America/New_York",
+ expectedDate: "2026-01-21", // Should be today, not tomorrow
+ },
+ {
+ name: "late night edge case",
+ serverTime: time.Date(2026, 1, 22, 4, 0, 0, 0, time.UTC), // 11pm ET
+ userTZ: "America/New_York",
+ expectedDate: "2026-01-21",
+ },
+ }
+ // ...
+}
+```
+
+## Proposed Approach
+
+1. **Identify the source:**
+ - Check quick-add handler: how is default date determined?
+ - Check template: is date set server-side or client-side JS?
+ - Check if using `time.Now()` (server's timezone) vs user's timezone
+
+2. **Likely fix:**
+ - If server-side: pass user's timezone preference and convert
+ - If client-side: use `new Date()` which uses browser's local time
+ - Ensure consistent timezone handling throughout
+
+3. **Verify date calculation:**
+ - `today` should be based on user's local date, not UTC date
+ - Evening in US Eastern (UTC-5) at 8pm = UTC next day 1am
+
+## Debugging Steps
+1. Check current time on server vs browser
+2. Inspect what value is sent in quick-add form
+3. Check JavaScript date initialization if client-side
+4. Check Go `time.Now()` usage if server-side
+
+## Affected Components
+- `internal/handlers/handlers.go` (quick-add endpoint/template data)
+- `web/templates/partials/` (quick-add form)
+- `web/static/` (if JS sets date)
+- Potentially user preferences for timezone
+
+## Definition of Done
+- [ ] Quick add defaults to user's local today, regardless of time
+- [ ] Works correctly in evening hours
+- [ ] Works across timezone boundaries
+- [ ] Unit test covers evening edge case