open-pod/lib/podcast_feed_web/views/feed_view.ex
2020-05-22 20:04:15 +00:00

10 lines
281 B
Elixir

defmodule PodcastFeedWeb.FeedView do
use PodcastFeedWeb, :view
def format_length(length) do
parsed = length / 100 / 60
min = parsed |> trunc
sec = parsed - min |> Float.floor(2) |> Float.to_string() |> String.split(".") |> Enum.at(1)
"#{min}:#{sec}"
end
end