summaryrefslogtreecommitdiff
path: root/internal/models/timeline.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/models/timeline.go')
-rw-r--r--internal/models/timeline.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/internal/models/timeline.go b/internal/models/timeline.go
index 0968d41..c4196bd 100644
--- a/internal/models/timeline.go
+++ b/internal/models/timeline.go
@@ -36,6 +36,8 @@ type TimelineItem struct {
// UI enhancement fields
IsCompleted bool `json:"is_completed"`
+ IsOverdue bool `json:"is_overdue"`
+ IsAllDay bool `json:"is_all_day"` // True if time is midnight (no specific time)
DaySection DaySection `json:"day_section"`
Source string `json:"source"` // "todoist", "trello", "plantoeat", "calendar", "gtasks"
@@ -43,7 +45,7 @@ type TimelineItem struct {
ListID string `json:"list_id,omitempty"` // For Google Tasks
}
-// ComputeDaySection sets the DaySection based on the item's time
+// ComputeDaySection sets the DaySection, IsOverdue, and IsAllDay based on the item's time
func (item *TimelineItem) ComputeDaySection(now time.Time) {
// Use configured display timezone for consistent comparisons
tz := config.GetDisplayTimezone()
@@ -56,6 +58,12 @@ func (item *TimelineItem) ComputeDaySection(now time.Time) {
itemDay := time.Date(localItemTime.Year(), localItemTime.Month(), localItemTime.Day(), 0, 0, 0, 0, tz)
+ // Check if item is overdue (before today)
+ item.IsOverdue = itemDay.Before(today)
+
+ // Check if item is all-day (midnight time means no specific time)
+ item.IsAllDay = localItemTime.Hour() == 0 && localItemTime.Minute() == 0
+
if itemDay.Before(tomorrow) {
item.DaySection = DaySectionToday
} else if itemDay.Before(dayAfterTomorrow) {