diff options
Diffstat (limited to 'issues/010-fix-quick-add-timestamp.md')
| -rw-r--r-- | issues/010-fix-quick-add-timestamp.md | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/issues/010-fix-quick-add-timestamp.md b/issues/010-fix-quick-add-timestamp.md deleted file mode 100644 index 3c59325..0000000 --- a/issues/010-fix-quick-add-timestamp.md +++ /dev/null @@ -1,76 +0,0 @@ -# [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 |
