diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-01-25 17:15:23 -1000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-01-25 17:15:23 -1000 |
| commit | 4420aace9c0ee1bb3255190234f4a2035619b473 (patch) | |
| tree | e5dc0fe1878984fbefeb012e235df896b63de4f0 /internal/models | |
| parent | 6518a7ed5ee8800741351166a724da53cb2f271e (diff) | |
Fix timezone and date handling bugs #40, #41, #42
#40, #41: Fix calendar event timezone handling
- Parse all-day events in local timezone using ParseInLocation
- Convert timed events to local time after parsing RFC3339
- Update ComputeDaySection to normalize both now and item time to local
before comparison, ensuring consistent today/tomorrow classification
#42: Mobile conditions page now uses 2 columns
- Changed 600px breakpoint from 1 column to 2 columns
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'internal/models')
| -rw-r--r-- | internal/models/timeline.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/internal/models/timeline.go b/internal/models/timeline.go index 469cce4..54f7f45 100644 --- a/internal/models/timeline.go +++ b/internal/models/timeline.go @@ -37,11 +37,15 @@ type TimelineItem struct { // ComputeDaySection sets the DaySection based on the item's time func (item *TimelineItem) ComputeDaySection(now time.Time) { - today := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location()) + // Ensure we're working in local timezone for consistent comparisons + localNow := now.Local() + localItemTime := item.Time.Local() + + today := time.Date(localNow.Year(), localNow.Month(), localNow.Day(), 0, 0, 0, 0, time.Local) tomorrow := today.AddDate(0, 0, 1) dayAfterTomorrow := today.AddDate(0, 0, 2) - itemDay := time.Date(item.Time.Year(), item.Time.Month(), item.Time.Day(), 0, 0, 0, 0, item.Time.Location()) + itemDay := time.Date(localItemTime.Year(), localItemTime.Month(), localItemTime.Day(), 0, 0, 0, 0, time.Local) if itemDay.Before(tomorrow) { item.DaySection = DaySectionToday |
