// Package models defines the core data structures for the application. package models import "time" // Event represents a calendar event. type Event struct { ID string Title string Description string Start time.Time End time.Time AllDay bool Location string Source EventSource } // EventSource indicates where an event originated from. type EventSource string const ( SourceLocal EventSource = "local" SourceCalDAV EventSource = "caldav" ) // IsOnDate checks if the event occurs on the given date. func (e *Event) IsOnDate(date time.Time) bool { eventDate := e.Start.Truncate(24 * time.Hour) checkDate := date.Truncate(24 * time.Hour) if e.AllDay { endDate := e.End.Truncate(24 * time.Hour) return !checkDate.Before(eventDate) && checkDate.Before(endDate) } return eventDate.Equal(checkDate) }