spazio-solazzo/lib/spazio_solazzo/data/calendar_ext.ex
2026-01-10 19:03:02 +01:00

16 lines
450 B
Elixir

defmodule SpazioSolazzo.CalendarExt do
@moduledoc """
Extension module for Calendar with helper date and time formatting functions
"""
def format_date(date) do
Calendar.strftime(date, "%B %d, %Y")
end
def format_time_range(%{start_time: start_time, end_time: end_time}) do
start_time = Calendar.strftime(start_time, "%I:%M %p")
end_time = Calendar.strftime(end_time, "%I:%M %p")
"#{start_time} - #{end_time}"
end
end