Date utility functions for LiveFilter. Handles date range calculations for presets and custom ranges.
Summary
Functions
Generates weekly chunks for calendar display. Returns a list of weeks, where each week is a list of 7 dates.
Returns the default list of date presets in chronological order.
Formats a date for display in the filter chip. Handles both Date structs and ISO8601 strings.
Formats a date range for display. Returns "Feb 14, 2026" for same-day ranges, "Feb 1 - Feb 14, 2026" for multi-day. Handles both Date structs and ISO8601 strings.
Checks if a date is within the selected range (exclusive of endpoints).
Parses a preset atom into a date range tuple {start_date, end_date}.
Returns a human-readable label for a preset.
Checks if a date is selected (start or end of range).
Functions
Generates weekly chunks for calendar display. Returns a list of weeks, where each week is a list of 7 dates.
@spec default_presets() :: [atom()]
Returns the default list of date presets in chronological order.
@spec format_date(Date.t() | DateTime.t() | String.t() | nil) :: String.t()
Formats a date for display in the filter chip. Handles both Date structs and ISO8601 strings.
Formats a date range for display. Returns "Feb 14, 2026" for same-day ranges, "Feb 1 - Feb 14, 2026" for multi-day. Handles both Date structs and ISO8601 strings.
Checks if a date is within the selected range (exclusive of endpoints).
Parses a preset atom into a date range tuple {start_date, end_date}.
Special cases:
:overduereturns{nil, yesterday}for open-ended past range
Returns a human-readable label for a preset.
Checks if a date is selected (start or end of range).