Documentation
¶
Index ¶
- func ConvertFormInputToICalFormat(dateStr, timeStr, originalICalValue string) (string, error)
- func FormDateDisplay(icalValue string) (string, error)
- func FormTimeDisplay(icalValue string) (dateStr, timeStr string, err error)
- func GetEventTimes(event *ical.Event) (LocalTime, LocalTime, error)
- func IsValidEndTime(value string) bool
- func IsValidICalDate(value string) bool
- func IsValidICalDateTime(value string) bool
- func IsValidStartTime(value string) bool
- func PopulateFormFromEvent(event *ical.Event) (startDate, startTime, endDate, endTime string, err error)
- func PreserveTimezoneFormat(localTime LocalTime, originalValue string) string
- func SetEventDateTimeProperty(event *ical.Event, propName string, localTime LocalTime, originalValue string)
- func ValidateICalTimeRange(startValue, endValue string) error
- func ValidateTimeRange(startTime, endTime LocalTime) error
- type LocalTime
- func GetEventEndTime(event *ical.Event) (LocalTime, error)
- func GetEventStartTime(event *ical.Event) (LocalTime, error)
- func NewLocalTime(t time.Time) LocalTime
- func NewLocalTimeFromDateTime(dateStr, timeStr string) (LocalTime, error)
- func ParseFormInput(dateStr, timeStr string) (LocalTime, error)
- func ParseICalDate(icalValue string) (LocalTime, error)
- func ParseICalDateTime(icalValue string) (LocalTime, error)
- func (lt LocalTime) Add(d time.Duration) LocalTime
- func (lt LocalTime) AddDate(years, months, days int) LocalTime
- func (lt LocalTime) After(other LocalTime) bool
- func (lt LocalTime) Before(other LocalTime) bool
- func (lt LocalTime) Date() (year int, month time.Month, day int)
- func (lt LocalTime) Equal(other LocalTime) bool
- func (lt LocalTime) Format(layout string) string
- func (lt LocalTime) String() string
- func (lt LocalTime) Sub(other LocalTime) time.Duration
- func (lt LocalTime) ToICalFormat(originalValue string) string
- func (lt LocalTime) ToUTC() time.Time
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertFormInputToICalFormat ¶
ConvertFormInputToICalFormat converts form input to iCal format while preserving timezone context Uses the original iCal value to determine the correct output format
func FormDateDisplay ¶
FormDateDisplay converts an iCal date value to user-friendly date string for forms
func FormTimeDisplay ¶
FormTimeDisplay converts an iCal datetime value to user-friendly local time strings for forms Returns separate date and time strings for form fields
func GetEventTimes ¶
GetEventTimes extracts both start and end times from an ical.Event as LocalTime
func IsValidEndTime ¶
IsValidEndTime validates an end time string in any accepted format
func IsValidICalDate ¶
IsValidICalDate validates an iCal date string format (for all-day events)
func IsValidICalDateTime ¶
IsValidICalDateTime validates an iCal datetime string format
func IsValidStartTime ¶
IsValidStartTime validates a start time string in any accepted format
func PopulateFormFromEvent ¶
func PopulateFormFromEvent(event *ical.Event) (startDate, startTime, endDate, endTime string, err error)
PopulateFormFromEvent extracts display-friendly values from an ical.Event for form population Returns separate date and time strings that can be shown to the user
func PreserveTimezoneFormat ¶
PreserveTimezoneFormat formats a LocalTime for iCal storage while preserving the original format This prevents timezone corruption when updating events
func SetEventDateTimeProperty ¶
func SetEventDateTimeProperty(event *ical.Event, propName string, localTime LocalTime, originalValue string)
SetEventDateTimeProperty safely sets a datetime property on an event while preserving timezone format
func ValidateICalTimeRange ¶
ValidateICalTimeRange validates that two iCal time strings form a valid range
func ValidateTimeRange ¶
ValidateTimeRange ensures end time is after start time
Types ¶
type LocalTime ¶
LocalTime is always in user's local timezone to prevent timezone bugs This type enforces that all calendar display operations use local time
func GetEventEndTime ¶
GetEventEndTime extracts end time from an ical.Event as LocalTime
func GetEventStartTime ¶
GetEventStartTime extracts start time from an ical.Event as LocalTime
func NewLocalTime ¶
NewLocalTime ensures time is in local timezone
func NewLocalTimeFromDateTime ¶
NewLocalTimeFromDateTime creates LocalTime from separate date and time strings
func ParseFormInput ¶
ParseFormInput converts user form input (date + time strings) to LocalTime This is the safe way to handle user input, always interpreting as local time
func ParseICalDate ¶
ParseICalDate safely parses an iCal date value (for all-day events)
func ParseICalDateTime ¶
ParseICalDateTime safely parses an iCal datetime value into LocalTime Handles both UTC (20060102T150405Z) and local (20060102T150405) formats
func (LocalTime) ToICalFormat ¶
ToICalFormat formats time for iCal storage, preserving the original timezone context